2017-07-25 12:03 PM
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!
2017-07-25 12:43 PM
Tried walking it through with RealTerm sending it hex bytes?
I don't think adding delays between them will help at all, I send strings of multiple bytes.
2017-07-25 02:46 PM
{ // Tx: 21 Go 0x08000000 SP=[0], PC=[4]
BYTE data[7] = { 0x21, 0xDE, 0x08, 0x00, 0x00, 0x00, 0x08 };2017-07-25 07:07 PM
I will do that. I'm not familiar with the syntax above. Downloaded RealTerm. Set baud, parity, data, stop, and flow control. Looks like bytes can be sent using the Send tab, but what was your test setup for sending the bytes?
Thanks!