I'm using a custom board which includes a ADuCM4050 microcontroller. Everything is fine with hardware and FW code, so I discard any possible issue related with them.
In this moment, I'm developing a bootloader script in Python following the information and steps described into the user guide document (UG-1160). The user guide contains information related with the way to communicate with kernel through UART, as well as the different commands you can use to send and interact with it. These commands are WRITE, RUN and INFO.
After HW-reset keeping pushed SYS_BMODE0 pin, UART Downloader code waits for a '\r' character to initiate the UART autobaud process. If it receives it, the kernel sends the device information as an acknowledge. After that, I tried to send INFO command and I noticed that 'I' character in ASCII doesn't correspond with 0x45 hex value, but 0x49. That means you can't use 'I' character literally. Instead, you may send 0x45 in char format. Once that's done, kernel responds with device information as it is described in the document, that is, it sends ACK and device information.
Please, check Table 10, because there is another mistake related with 'I' hex value.
Now INFO command works succesfully. The next command I used is RUN command (after download a FW code through IDE). No problem with it. As INFO command, I receive an ACK (0x06) and then runs user code.
Finally, I'm trying to download FW code by using WRITE command, but it doesn't respond as I expected. I don't receive any ACK or NACK. In addition, it beggins to execute user code, so maybe the CRC is bad calculated or the address is out of range. If user code is blank, I receive some crap data and it is still waiting to receive a new command.
The address I'm trying to use is 0x00000000 and the data content is a hex file obtained from IDE. Each sent packet is composed by a 259 bytes array, which includes:
- 2 ID bytes
- 5 + n number bytes from Number of Data Bytes field.
- CMD byte
- 4 bytes from start address.
- n bytes of data (lower or equal than 250, as 5 + 250 is maximum value).
If CRC is calculated as 1 byte (like other commands, I mean, in the same way), the sum is 259 byte array.
I think there is a problem with CRC calculation, but I don't know how to solve it.
Thank you very much.
I forgot to say I tried to use both hex and bin file when I sent WRITE command. I know it should be the same, but I had to try it, just in case.
I have two more questions: when I send packets I do it using an array with all necessary information. Every byte I send is in char format (as I said before), otherwise it doesn't work properly. For WRITE command, do I need to use the same format like other cases? Or is it different?
Furthermore, the CRC for INFO and RUN commands is calculated with two's complement sum of all bytes. Is it the same case for WRITE command? Should I have any other considerations?
I wonder if you could help me or give me some advices with this issue.