UART Bootloder protocol: Write command have no effect on memory, despite all required ACKs recieved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-21 7:15 AM
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.
- Labels:
-
Bootloader
-
STM32F4 Series
-
UART-USART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-21 7:34 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-21 8:44 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-21 11:18 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-22 5:02 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-22 5:05 AM
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-22 5:16 AM
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..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-22 5:18 AM
Well, it was something random, data there is lost now.
Sorry, i didn't reply.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-22 5:21 AM
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.
