AP08113
Capacitive-Touch Color Wheel Implementation
Downloading Modified Color Wheel Software Code
Application Note
15
V1.0, 2010-08
5
Downloading Modified Color Wheel Software Code
The Color Wheel Application Kit is prepared to start up automatically after power-on reset. This is achieved by
programming the Boot Mode Index (BMI) to User Mode (Productive). To download the software code, the
“accessing of UART BSL Mode” code must be included in the user flash code at all times (see
Section 5.1
).
The procedure to enter the UART BSL Mode to update software code is as follows:
•
Plug in Color Wheel board to computer, via USB, to start up the board
•
Open DAvE-Bench (XC800_FLOAD) tool (Device: XC82x-1F; Protocol: UART; Physical Interface: Half
Duplex; set COM port)
•
Click on “Connect” button to connect UART BSL Mode (
P2.0 and P2.1 are controlled by XC800_FLOAD
)
•
Device is in UART BSL Mode (
Notice that the “On/Off” and color mode LEDs are off
)
•
Click on “Write User ID” button to program BMI to UART BSL Mode
•
Erase flash (optional)
•
Open hex file and download code to Flash.
•
Execute Flash and observe Color Wheel board
Note: Ensure that the access code to UART BSL Mode is included in code to allow future software updating. Once
the code is verified, the user can re-program the device to User Mode (Productive).
Attention: It is recommended to program BMI to UART BSL Mode before updating the software code. This
is a safer approach and it will ensure that the device can be accessed via UART BSL Mode at
all times. Only program the BMI back to User Mode (Productive) when the updated software
code is proven to be working and is in a finished state.
5.1
Access Code to UART BSL Mode
In order to allow software updating, the following code must be included in the user flash code at all times:
•
Soft reset - triggered by external interrupt 0 (low level triggered at P2.0). This emulates a Reset pin. [INT.C]
•
Enter UART BSL Mode - upon start up, check P2.1 for low to enter UART BSL Mode. [MAIN.C]
Note: The 2 port pins are controlled by the XC800_FLOAD tool to trigger a soft reset and to enter UART BSL Mode
at next boot-up.
Note: The user can define specific conditions to program the BMI value to access to UART BSL Mode.
MAIN.C
void main(void)
{
// USER CODE BEGIN (MAIN_Main,2)
....
......
if( (!(P2_DATAIN & 0x02)) && (P2_DATAIN & 0x01) )
{
while(--j);
// wait for FTDI device to enumerate and startup
if( !(P2_DATAIN & 0x02) ) // Only enter BSL in case "MBC" is low
{
EA = 0;
// disable interrupts
NMICON = 0x00;
// disable NMIs
SP = 0xE0;
// move stack pointer outside flash buffer
BR_UART_BSL();
// start UART BSL
}
}
// USER CODE END
All manuals and user guides at all-guides.com