cancel
Showing results for 
Search instead for 
Did you mean: 

Bootloader UART: NACK to Write Command when try to write data to valid RAM memory addresses

not_cheater
Associate II

To whom it may concern:

We are currently developing a wearable devices, which is running on a STM32L031. In Bootloader mode, while I am trying to write data to vaild RAM address(0x20001F00), it returns NACK. Every step is followed instruction, but it just won't work on STM32L031 platform. Then I ran the same code try to write STM32H750 address and success(write  to 0x20004108). I think I can't solve this on my own, Please help. :crying_face:
I've attached a logic analyzer photo includes UART data, first line is host side, second one is device side.(See attachments)

By the way( Another question), I have two identical MCU(let's call master and slave) which connected with UART, I want to copy master's firmware to slave through UART bootloader. The hardware connection is correct and the bootloader can be entered. In this write process, on every stage slave returns ACK, but after reboot the code doesn't run. Then I dumped slave's hex file by SWD and compared with master's one using hex comparson tool, then I found many differences( about 30% is wrong). Shoud I erase flash before I write? Is there any host code example? Any suggestion would help. My MCU is STM32L031. The waveforms seen with the oscilloscope are quite good.

Application note used: AN3155 ver.16, AN2606 ver.59

MCU : STM32L031E6Y6DTR

UART info : baud rate 62500(because HSI is 32M, I've already tried 115200, 9600), parity even, 8bits , 1 stop bit.

For unknown reason I can't attach photo to context or upload, I have to upload a docx file. Sorry for unconvient.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Can't see what's wrong with the first example. You're trying to write to 0x20001F00. Bootloader uses the first 4 kB of RAM, but this is outside of that. Chip has 8kB of RAM and this is within that. Perhaps bootloader doesn't support writes to RAM at all.

> Shoud I erase flash before I write?

Yes, flash must be erased before it can be written.

> For unknown reason I can't attach photo

What file type are you trying to upload? Common picture formats should work.

 

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

3 REPLIES 3
TDK
Guru

Can't see what's wrong with the first example. You're trying to write to 0x20001F00. Bootloader uses the first 4 kB of RAM, but this is outside of that. Chip has 8kB of RAM and this is within that. Perhaps bootloader doesn't support writes to RAM at all.

> Shoud I erase flash before I write?

Yes, flash must be erased before it can be written.

> For unknown reason I can't attach photo

What file type are you trying to upload? Common picture formats should work.

 

If you feel a post has answered your question, please click "Accept as Solution".
not_cheater
Associate II

Yes, I tried to erase flash before write, and it works as expected. Thank you.

For the first example, starting from which version, the bootloader supports writing to memory, do you still remember? It doesn't matter if you don't. 
> What file type are you trying to upload? 
jpeg. It just shows upload failed. I don't think it's a big problem.

Writing to memory is a critical feature of the bootloader. I would expect that all bootloader versions would support it, but have no real way of checking.

If you can write to normal flash at 0x08000000, but can't write to 0x20001F00, probably there is an issue with the chip checking for valid memory locations. Or it's an invalid location and we're missing something.

 

If you feel a post has answered your question, please click "Accept as Solution".