cancel
Showing results for 
Search instead for 
Did you mean: 

UART Bootloder protocol: Write command have no effect on memory, despite all required ACKs recieved.

MBrze.2
Associate II

Hi, i have problem with bootloader protocol on USART. Write command gives all ACKs but there is no effect on memory.

Other commands seems to work fine, with all ACKs, i can read memory fine. I was checking memory using STM Programmer.

I'm using NUCLEO F439ZI.

Termios settings for UART are:

cfmakeraw(&settings);

settings.c_cflag &= ~PARODD;

settings.c_cflag |= PARENB;

settings.c_cflag &= ~CSTOPB;

settings.c_cc[VMIN] = 0;

settings.c_cc[VTIME] = 10;

cfsetispeed(&settings, B115200);

cfsetospeed(&settings, B115200);

Commands used for tests are:

printf "\x7F\x31\xCE" >/dev/ttymxc2

printf "\x08\x00\x00\x00\x08" >/dev/ttymxc2

printf "\x03\x55\x55\x55\x55\x03" >/dev/ttymxc2

For those commands i receive 4 ACKs.

Then using :

 printf "\x7F\x11\xEE" >/dev/ttymxc2

 printf "\x08\x00\x00\x00\x08" >/dev/ttymxc2

 printf "\x0F\xF0" >/dev/ttymxc2

Gives unchanged memory back.

8 REPLIES 8
TDK
Guru

0x7F is only used once to start bootloader mode. You shouldn't be using it between each command. I would expect stray 0x7Fs to cause a NACK.

You should probably wait between the very first 0x7F and the first command sent to allow the chip time to enter UART bootloader mode, although it might not be needed.

If that's not it, not sure. I've used the UART bootloader on the STM32F4 extensively.

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

You are erasing the flash before writing to it, correct? What values do you receive back? Flash bits can only go from 1 to 0 when writing.

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

No, i'm not erasing the flash. Does every write require clearing whole flash before that?

I'm using 0x7F only one time, between resetting device into bootmode.

The problem is i don't get NACKs.

If you want to change bits from 0 to 1, you need to erase the flash page.

You didn't answer my question about what values you receive back.

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

I only get ACKs back.

If you mean what i get back when i read from memory, then i receive the same memory that there was. (checked using STMprogrammer)

This is harder than it should be.

What was the value of the memory? I'm looking for *actual numbers* that correspond to the value of the 4 bytes in the locations you're attempting to write..

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

Well, it was something random, data there is lost now.

Sorry, i didn't reply.

Do you think that specific data would help with this issue? What insight could it give us?

I'm asking because the data is lost now.