1408 views|0 replies

1140

Posts

0

Resources
The OP
 

C2000 Power-on Boot Mode Analysis [Copy link]

When using C2000, engineers often say that the chip simulation can run, but the stand-alone run cannot run; or when debugging, reset the chip > run, and find that the program cannot run. The main reason for this is that they do not understand the boot mode setting of C2000. In addition, when we want to boot the chip in other ways, we often need to know clearly how the C2000 boot is set. Therefore, I would like to share with you my understanding of the C2000 boot mode, hoping to help you understand the chip operation from power-on to running to main.
Taking the boot mode of the C2000 Piccolo series as an example, the delfino is slightly different, and the concerno series boot is more complicated. But understanding the boot principle of Piccolo is very helpful for us to understand the chips of the latter two series.
1. First, let's look at the code execution flow after the chip is powered on according to Figure 1. When the chip receives a reset signal, it will go to 0x3FFFC0 to reset the vector, and the reset vector will jump to BootROM 0x3FF75C to execute the bootloader program, which mainly includes initboot, SelectBootMode, and some peripheral boot functions. SelectBootMode determines where the chip should look for the program entry based on the chip's hardware or software settings. The direct purpose is how to find main and then execute the application.
Figure 1. Chip reset flow chart
[color=rgb(85, 85, There are two most commonly used boot modes: one is boot to RAM, which jumps to the RAM at 0x000000 to start executing instructions, mainly for the simulation mode in which the program is loaded into RAM; the other is boot to Flash, which jumps to 0x3F7FF6 to start executing code. Correspondingly, the program will put a jump instruction at the two entry addresses 0x000000 and 0x3F7FF6 in the codestart.asm source file. The reason is that there are only two units of space at the entry address of Flash, followed by the CSM module, so a jump is required; and the reason why a jump is also required in RAM is mainly because before jumping to main, a small piece of code _c_int00 needs to be executed. This code will use a section of RAM after 0x000003. If the code is placed there, the code will be damaged after executing _c_int00. In addition, there are some peripheral boot modes, such as SCI boot and SPI boot. The C2PROG software we often use supports SCI boot, and then downloads the program through the serial port. 2. How does the SelectBootMode function of the chip determine the boot mode of the chip? From Figure 2, we can see that it first determines whether the chip is connected to the emulator based on the state of the TRST pin. If the emulator is connected, it will enter the emulation boot mode. At this time, the boot mode of the chip is mainly determined by two RAM units, namely EMU_BMODE and EMU_KEY, with addresses 0xD01 and 0xD00. Therefore, after connecting the emulator, we can first modify these two EMU_BMODE and EMU_KEY to set the boot mode. If the emulator is not connected, it will enter the stand alone mode. At this time, the boot mode of the chip is mainly determined by the status of GPIO34 and GPIO37, as well as the values of two OTP storage units. However, we often do not use these two OTP units, and the status of GPIO is enough.
Figure 2. Boot mode in two states
3. Boot mode configuration when the emulator is connected
When using an emulator, the chip will determine the boot mode based on the values of the two units EMU_BMODE and EMU_KEY. For example, the most common boot mode when using an emulator is to boot to RAM, which requires setting EMU_KEY = 0X55AA and EMU_BMODE = 0X000A. When we are emulating and the program is loaded to Flash, we need to set EMU_KEY = 0X55AA and EMU_BMODE = 0X000B. If EMU_BMODE = 0x0003, since we have not operated the OTP unit, the value of OTP is 0xFFFF, so in this case it is also boot to flash.
When running the program with the emulator, we found that even if we do not configure the boot mode, the program can still run to main. This is mainly because of the function of CCS. When the program is loaded into the chip, or reset > restart, CCS will automatically shield the bootloader process and automatically jump to the main function entry. If we only choose to reset the CPU, we need to configure the boot mode, that is, write the corresponding values to the two units 0x0d01 and 0x0d00 in the memory window, or select the boot mode in the script menu, so that the program can run to main.
4. Stand-alone operation is boot mode configuration
When running stand-alone, we usually run to Flash. At this time, we need to configure the GPIO34 and GPIO37 pins to high level. Since the Piccolo series chips have internal pull-up enabled by default when powered on, it is OK even if pull-up resistors are not added. At this time, the boot mode is GetMode. Since we did not configure the two OTP units, the two units default to 0xFFFF, so the boot mode of the chip is finally boot to Flash.
5. Boot modes of other peripherals
From the above pictures, we can see that there are many peripheral boot functions. Taking SCI boot as an example, when running with an emulator and stand-alone, the corresponding storage units and GPIO port status must be configured to configure it as SCI boot mode. Then the chip will SCI boot function, ready to receive the serial port code, the host computer will generate the SCI boot data stream format according to the SCI boot communication protocol, send the data to the chip through the serial port, the chip bootloader will receive the code, after receiving it, it will start to execute the code downloaded from SCI according to the starting running address in the data stream.85)]From the above pictures, we can see that there are many peripheral boot functions. Take SCI boot as an example. When running with an emulator or a stand-alone machine, the corresponding storage unit and GPIO port status must be configured to configure it as SCI boot mode. Then the chip will SCI boot function and prepare to receive the serial port code. The host computer will generate the SCI boot data stream format according to the SCI boot communication protocol and send the data to the chip through the serial port. The chip bootloader will receive the code and start executing the code downloaded from SCI according to the starting running address in the data stream.
85)]From the above pictures, we can see that there are many peripheral boot functions. Take SCI boot as an example. When running with an emulator or a stand-alone machine, the corresponding storage unit and GPIO port status must be configured to configure it as SCI boot mode. Then the chip will SCI boot function and prepare to receive the serial port code. The host computer will generate the SCI boot data stream format according to the SCI boot communication protocol and send the data to the chip through the serial port. The chip bootloader will receive the code and after receiving it, it will start executing the code downloaded from SCI according to the starting running address in the data stream.
This post is from Microcontroller MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list