I2C Bootloader Implemented using PSoC - IJETAE

6 downloads 1320 Views 349KB Size Report
FEATURES OF PSOC 3 AND PSOC 5 ARCHITECTURES. Microcontroller companies try to find the magic mix of. CPU, memories, and peripherals that wins  ...
International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, Volume 2, Issue 9, September 2012)

I2C Bootloader Implemented using PSoC Mayank Gupta1, Manreet Kaur2 1

Assistant Professor, 2Student, Lovely Professional University, Punjab, India

Abstract— This document is regarding the concept by which we can go beyond microcontrollers. This new standard is not just a matter of improving upon the competition. This is achievable by a revolutionary system named PSoC. This work sets a new example based on Cypress Programmable System on Chip (PSoC) that describes how to add an I2C bootloader to a PSoC 3 and PSoC 5 project.

III. BOOTLOADER CONCEPT This bootloader allows a processor to change its firmware without any physical intervention to the device itself. There is no need for a hardware programmer when using the bootloader. The firmware is downloaded from a host system by means of a communication channel, usually through a USB or a serial port. This bootloader implementation uses a standard I2C bus as a communication channel between the microcontroller and the host system. In general, when using a bootloader, the code is transferred from a host device. Typically, this is comprised of a PC computer using a RS-232 serial cable or a USB port. Any other device can act as a host device. The target device needs bootloader firmware. This is basically software that accepts commands and data from a host device and reads/erases/writes data to the Flash program memory. Figure 1 shows a typical bootloader sytem.

Keywords— Development kit (DVK), MiniProg 3, PSoC 3, PSoC 5, Bootloader, PSoC Creator.

I. INTRODUCTION

I2C CHANNEL

The name PSoC (Programmable-System-on-Chip) defines its true identity. PSoC 1, PSoC 3 and PSoC 5 are all true programmable embedded system-on-chips that contains pre-designed and pre verified blocks, often called cores, are obtained from internal sources , and combined onto a single chip. These cores include configurable analog, programmable digital, memory, and a central processor that handle specific processing function. The ability to design entire analog systems within one chip, coupled with unparalleled flexibility in signal routing and reconfiguration, creates entirely new possibilities in electronics design [1]. II. FEATURES OF PSOC 3 AND PSOC 5 ARCHITECTURES

BOOTLOADER FLASH PSoC 3/ PSoC 5

Microcontroller companies try to find the magic mix of CPU, memories, and peripherals that wins most customers. It is a never ending goal to give users everything that they need while maintaining a cost effective solution. A single PSoC device and reconfigure it during run time to perform the needed duties that would normally require multiple devices i.e. when the power of PSoC device configurability really appears. The PSoC 3 and PSoC 5 architecture provides you with a programmable system-on-chip that excels in precision analog processing and digital flexibility. The PSoC platform offers 8-bit and 32-bit CPUs [2]. The architecture of the digital and analog peripherals is the same, giving the user the ability to choose the device that achieves the needed performance and the best value. The combination of analog and digital systems on the same chip not only allows you to consolidate your design into a smaller physical space, but also keeps those sensitive analog signals tight within the device itself. This secures a new level of noise immunity and environmental stability.

BOOTLOADABLE BOOT LOADER FLASH PSoC HOST3/ PSoC 5 Figure 1.Bootloader system

IV. METHODOLOGY We can very well understand the use and work of PSoC, by practically making a chip ready, to perform some specific functions by connecting it with other hardware devices like LCD, by which we can measure the result and find out the difference between the chip available in the market and the one that has been created using PSoC [2]. Let us take an example of an I2C Bootloader. Boot loading is the process by which we can upgrade our system firmware using standard communication interface such as I2C without using a programmer. 183

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, Volume 2, Issue 9, September 2012) If we need a fast I2C bootloader on PSoC 3 or PSoC5 project, there are some simple instructions to do so. We use a Cypress DVK (Development kit board) and Cypress MiniProg3 programming unit connected to a PC host [3]. The list of compatible PSoC devies, softwares, PSoC development kit and compiler are shown in table 1.

It is also better to make the power on and reset state to high-Z analog and also change the pin name to correct signal that is SDA. Similarly we can configure the second pin that is SCL. Now we can connect the pins of I2C component to any physical ports (on any port number). Now, change the bootloader system settings. I2C component is the only component on the schematic used by bootloader. For this demo we also need to extend the bootloader wait time to 1 second. Now we can start building the bootloader project. Check the “main c” file, you can see auto generated clock to the bootloader program. This project is now complete. Next we have to do some bootloadable projects on workspace. The first project is to display “hello” on the development kit LCD. Again we must open the advanced section and change the project type from normal to bootloadable. The next thing we have to do is link this project to bootloader project. For the link, place this project into different section of flash. Rest of the project is the same as standard project. Now we add another bootloadable project that is same as hello project, but displays a different message i.e. “Goodbye” on the development kit LCD. Then build both bootloadable projects. Now let’s start with the development kit to test the projects that we have created. Now program the PSoC 3 on the development kit with the bootloader project using MiniProg 3 using standard SWD connection. After programming nothing happens. The bootloader is waiting for a bootloadable project to be downloaded. Next connect the MiniProg 3 to bootloader’s I2C port using a special header on the port 5 pins. And leave the SWD connected. Now we can actually do some bootloading. Bring up the bootloader host program supplied with PSoC Creator. So at MiniProg 3 this been used and set the port configuration, speed and slave address to match the bootloader’s I2C port. Now find the file which has to be downloaded. Open the “hello” or “Goodbye” project and browse the hex file. The main function of bootloader PC host is importing hex file, splitting it into smaller packets and sending the data to the bootloaded device. After programming is complete we can see the message displayed on the development kit LCD.

TABLE I LIST OF COMPATIBLE DEVICES AND SOFTWARE USED FOR THIS PROJECT

Device Architecture

Software used

Development kit (DVK)

PSoC 3

PSoC Creator (Version 2.0)

CY8CKIT001

Compiler

Keil

Figure 2. Practical implementation of the program on the Development kit (CY8CKIT- 001) with MiniProg 3

The above figure shows Practical implementation of the program on the Development kit (CY8CKIT- 001) with MiniProg 3. The first step is to create a project using PSoC Creator; in this case the project type is not normal. It is a type of bootloader. This change can be made by opening the advanced section. Since we build three projects in the same workspace. First we can work on the project named as bootloader. A bootloader project must have a communication component. In this project we use I2C Bootloader, therefore we will add I2C component to the project schematic design [4]. Here we use I2C fixed function block in slave mode which is conveniently provided as a PSoC Creator macro. Default setting for this macro is 100kbps data rate with slave address 4. We can also use the option to configure the data rate and slave address. Now the pins are configured for I2C bus. However if the I2C bus that we are using doesn’t have pull up Resistor, we can change the pin mode to use the pin’s internal pull up resistor.

V. CONCLUSION We have used PSoC Creator to create simple bootloader and bootloadable programs for PSoC 3 and PSoC 5. The bootloader system is very flexible. It supports different communication protocols and other custom settings. A bootloader enables field updates of device firmware without the need for dedicated external programming hardware. 184

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, Volume 2, Issue 9, September 2012) The PSoC 3 and PSoC 5 I2C bootloader provided by the PSoC Creator allows us to easily upgrade a bootloadable project over an I2C interface [5]. We can also use PC based bootloader host application that allows us to download a new bootloadable project to PSoC 3 or PSoC 5. Finally we can design our own I2C bootloader host program for any embedded host controller, using the API provided with PSoC Creator. REFERENCES [1]

[2] [3] [4]

[5]

Zhaohui Ye and Chengying Hua, “An Innovative Method of Teaching Electronic System Design With PSoC” IEEE TRANSACTIONS ON EDUCATION, VOL. 55, NO. 3, AUGUST 2012. CY8C38 Family Datasheet [online]. Available: http://www.cypress.com/?rID=35178 CY8CKIT-001 PSoC Development Kit Guide [Online]. Available: http://www.cypress.com/?rID=37464 Ahmad A.M. Faudzi and K. Suzumori, “Programmable System on Chip Distributed Communication and Control Approach for Human Adaptive Mechanical System” Journal of Computer Science, Volume 6, Issue 8. Anu M D, “PSoC® 3 / PSoC 5 I2C Bootloader” Cypress Application Note AN60317 [online]. Available: http://www.cypress.com/?rID=41002.

185