AnsweredAssumed Answered

USART bootloader, no ACK from GO command

Question asked by Gordon Madden on Jul 25, 2017
Latest reply on Jul 26, 2017 by Gordon Madden

Hello!

 

I have used the bootloader in the stm32f417 for firmware updating, and the GO command always worked.

Now my program is hanging while waiting for an ACK from the bootloader. My C# code for the host:

Sending GO command:

                     var go = new byte[] { 0x21 };
            var de = new byte[] { 0xDE };

            byte_read = 0;
            _serialPort.Write(go, 0, 1);

            _serialPort.Write(de, 0, 1);

            // Receive ACK byte
 HANGS-->   byte_read = _serialPort.ReadByte();

            if (byte_read == NACK)
            {
                //Console.WriteLine("NACK received for GO COMMAND start");
            }

           

I tried putting in delays and placing it inside a while loop to repeatedly send and then receive the ACK:

            var go = new byte[] { 0x21 };
            var de = new byte[] { 0xDE };

            byte_read = 0;

            while (byte_read != 0x79)
            {
                _serialPort.Write(go, 0, 1);

                Thread.Sleep(100);

                _serialPort.Write(de, 0, 1);

                Thread.Sleep(100);

                // Receive ACK byte
  HANGS-->      byte_read = _serialPort.ReadByte();

                Thread.Sleep(300);

                //Console.WriteLine("ACK = 0x{0} for GO command", byte_read.ToString("X"));
                //Console.WriteLine("");

 

                if (byte_read == NACK)
                {
                    //Console.WriteLine("NACK received for GO COMMAND start");
                    //Console.WriteLine("");
                }

            }

 

Why would sending the GO command cause the program to block on the ACK byte?

I have stepped through the code with Keil and Visual Studio in debug and can see the correct bytes being sent to the USART.

This is the tale end of the firmware update app and the update is completed. I can restart the board and the firmware is there.

 

Any suggestions?

Thanks!

 

 

Outcomes