I have designed a PCB for a client recently, everything is fine with the hardware and software (application is working as it is supposed to). Now we are facing the need to update the program inside the microcontroller, but since these PCBs are installed at different places over the world, it would be perfect to install a bootloader and use the same UART as used by the application.
- One UART already used to communicate between board and PC
- Couple of I/Os for the application
- Couple of state LEDs
Relevant PINS and config
PA01 # Used for entering ISP with high level PA20 # Used for application and ISP UART PA21 # Used for application and ISP UART #define COM_USART (&AVR32_USART2) #define COM_USART_RX_PIN AVR32_USART2_RXD_0_0_PIN #define COM_USART_RX_FUNCTION AVR32_USART2_RXD_0_0_FUNCTION #define COM_USART_TX_PIN AVR32_USART2_TXD_0_0_PIN #define COM_USART_TX_FUNCTION AVR32_USART2_TXD_0_0_FUNCTION #define COM_USART_IRQ AVR32_USART2_IRQ #define COM_USART_BAUDRATE 115200
- Windows XP
- Atmel Studio 6.1
- AVRONE programmer
After many hours searching, I've found the Atmel Software Framework DFU, provided in ASF 126.96.36.1994. That was looking promising, I was able to install it on my board using provided tools :
- AVR32Studio 2.6.0
- program_at32uc3l-uart-isp-1.0.1.cmd (provided script with ASF)
- Flip 3.4.7 (batchisp)
At first, I used
.dat provided with ASF, installed using the script. Now trying to upload application using batchisp command :
batchisp.exe -device at32uc3l032 -hardware RS232 -port COM1 -baudrate 115200 -operation erase f memory flash blankcheck loadbuffer myapp.hex program verify
But always getting :
Device selection.................... PASS Hardware selection.................. PASS Opening port........................ PASS Synchronzing target................. FAIL Timeout error.
I've tested with oscilloscope RX and TX from UART, data is going to board but PC is receiving a 27kHz square wave (can't be data from UART since there is no stop bit or anything, also frequency is probably not the same for 115200bps).
After more research, I've configured
Word2 in file
at32uc3l-uart-isp_cfg-1.0.1.dat to get these values :
- Word1 : 0xE11E0024
- Word2 : 0x494F81AA
To use pin
PA01 as option to enter in the ISP.
Also, loaded the source of the DFU in Atmel Studio 6.1 and noticed they were not using same serial port configuration, so changed for the same as my application. Also added some LEDs toggle inside the main of the DFU.
After updating the bootloader in the board, no LEDs changes, same timeout, same square wave.
Am I missing something?