Menu

#106 Second byte of command not written [wrong parity]

none
Invalid
nobody
None
Medium
Other
2021-09-03
2019-01-27
Andrey
No

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
1 Attachments

Discussion

  • Andrey

    Andrey - 2019-01-27

    Sorry, it seems the usleep function is not needed, it works without it.

     
  • Ernst

    Ernst - 2019-01-28

    'Interface serial_posix: 38400 8N1

    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
    • Andrey

      Andrey - 2019-02-13

      This device not support even parity, only none parity (on attiny 2313).

       

      Last edit: Andrey 2019-02-13
  • Ernst

    Ernst - 2019-02-12

    Andrey, does this problem occur with newer versions of stm32flash and even parity setting?
    Can this ticket be closed?

     
    • Andrey

      Andrey - 2019-02-13

      Yes, thanks for the program.

       
  • Tormod Volden

    Tormod Volden - 2019-02-12
    • status: New --> NeedsInfo
    • Milestone: 0.5 --> none
     
  • Tormod Volden

    Tormod Volden - 2021-09-03
    • summary: Second byte of command not write --> Second byte of command not written [wrong parity]
    • status: NeedsInfo --> Invalid
    • Type: Defect --> Other
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB