Umpie / dangerous-prototypes-open-hardware

Automatically exported from code.google.com/p/dangerous-prototypes-open-hardware
0 stars 1 forks source link

'$' no longer causes bus pirate to reset to bootloader #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Over a serial terminal type '$' <enter> then when asked "are you sure" press 
'y'

What is the expected output? What do you see instead?
I expect to see:
HiZ>$
Are you sure? y
BOOTLOADER
and the `mode` LED come on.
I see the same text but with the `mode` LED off.
I can no longer enter any text over the serial port.

What version of the product are you using? On what operating system?
Built firmware from latest source (Firmware v6.3-beta1 r2088)
Talking via teraterm on win 7 x86

Please provide any additional information below.
Using a jumper between PGC and PGD still works as expected.
This was not broken in last stable version (6.1)

Original issue reported on code.google.com by andrew.p...@gmail.com on 29 May 2013 at 11:21

GoogleCodeExporter commented 8 years ago
I traced this back to revision r1955. In that revision, the "wait for TX done" 
line that is ran after $ is changed. It used to read:

    while (UART1TXRdy == 0); //wait untill TX finishes

But since that takes the address of the UART1TXRdy function (which is always 
non-zero) this comparison would always be false and this loop would never 
block. After r1955, the line reads:

    while (0 == UART1TXRdy()); //wait untill TX finishes

So now the function is actually called. I presume that for some reason that 
loop never finishes. Perhaps the TX never completes because it doesn't use 
interrupts on the BPv3 (that's just a guess, though).

In any case, if I comment out this while loop, the $ command works as expected 
again.

Original comment by matthijskooijman@gmail.com on 20 Oct 2013 at 8:58

GoogleCodeExporter commented 8 years ago
Cool, thanks :)

On 20 October 2013 21:58, <dangerous-prototypes-open-hardware@googlecode.com

Original comment by andrew.p...@gmail.com on 20 Oct 2013 at 11:31

GoogleCodeExporter commented 8 years ago
There is more related discussion here: 
http://dangerousprototypes.com/forum/viewtopic.php?f=4&t=5052&p=54931#p54923

Original comment by matthijskooijman@gmail.com on 21 Oct 2013 at 8:29

GoogleCodeExporter commented 8 years ago
I think I found a solution for the issue:
Change 
while (0 == UART1TXRdy()); //wait untill TX finishes
To
while (U1STAbits.TRMT == 0); //wait untill TX finishes

This way we wait to empty the WHOLE TX buffer before jumping to the bootloader. 

Original comment by sparky.s...@gmail.com on 31 May 2014 at 8:43