Second byte of command not written [wrong parity]
Open source flash program for STM32 using the ST serial bootloader
Brought to you by:
tormod
I am using archlinux x86, AMD Phenom(tm) II X6, avrcdc usb-uart and on my machine second byte not write correctly (crc code) and ack byte not returned.
stm32flash 0.5
http://stm32flash.sourceforge.net/
Interface serial_posix: 38400 8N1
Failed to read ACK byte
Unexpected reply from device on command 0x01
My changes:
diff --git a/serial_posix.c b/serial_posix.c
index 00625b8..aa40a27 100644
--- a/serial_posix.c
+++ b/serial_posix.c
@@ -303,12 +303,13 @@ static port_err_t serial_posix_write(struct port_interface *port, void *buf,
return PORT_ERR_UNKNOWN;
while (nbyte) {
- r = write(h->fd, pos, nbyte);
+ r = write(h->fd, pos, 1);
if (r < 1)
return PORT_ERR_UNKNOWN;
nbyte -= r;
pos += r;
+ usleep ( 5000 );
}
return PORT_ERR_OK;
}
and this fixed
stm32flash 0.5
http://stm32flash.sourceforge.net/
Interface serial_posix: 38400 8N1
Warning: the interface was not closed properly.
Version : 0x31
Option 1 : 0x00
Option 2 : 0x00
Device ID : 0x0444 (STM32F03xx4/6)
- RAM : Up to 4KiB (2048b reserved by bootloader)
- Flash : Up to 32KiB (size first sector: 4x1024)
- Option RAM : 16b
- System RAM : 3KiB
Anonymous
Sorry, it seems the usleep function is not needed, it works without it.
I think this should be 8E1 (EVEN parity)
The message "Unexpected reply from device on command 0x01" was observed to be related to wrong parity, see:
https://sourceforge.net/p/stm32flash/tickets/81/
Regards
Ernst
Last edit: Ernst 2019-01-28
This device not support even parity, only none parity (on attiny 2313).
Last edit: Andrey 2019-02-13
Andrey, does this problem occur with newer versions of stm32flash and even parity setting?
Can this ticket be closed?
Yes, thanks for the program.