From: Erich W. <ew....@na...> - 2012-01-13 19:06:30
|
Hi, On 01/13/2012 02:12 PM, Robert Epprecht wrote: > > But now if i try: > amforth-upload.py -v -t /dev/ttyACM0 lib/misc.frt > including file: './lib/misc.frt' > sending line: \ some definitions that may be useful > > amforth 4.6 ATmega328P > > > > Then it hangs... (independent of python version) I can confirm this behaviour. I think its interesting to note the timing stuff: 1. install .hex files on controller with programmer The controller is put into reset state and programmed. At the end, the reset is released, so 2. the controller goes out of reset and starts the amforth system. The last thing it does is printing out amforth 4.6 ATmega328P > The first line is the output of ver. The second line is the ok prompt. Nothing new here. HOWEVER, at this point in time you are NOT connected with amforth-upload.py. (You may be connected with minicom, then you see this output). 3. Now (assuming no minicom or other terminal is connected) amforth-upload.py opens the serial port and reads the above characters *again*. They are not sent, when amforth-upload.py opens the serial port. I suspect, that there is a fifo-buffer in the usb-serial stuff not being cleared. One key difference between the duemilanove and the uno is its connection from serial (controller) to the USB plug of the board. 4. amforth-upload.py is confused from this point on, because it sent some character, a '\' say, and it does not read back this backslash (the echoed response from amforth). The program will stall at this point. Matthias has suggested to add "dest.flush()" after line 103 of this snippet 102 for o in list(string): 103 dest.write(o); 104 dest.flush(); #<--- added here 105 if o == "\t": 106 o = " " 107 108 while True: But I never came around to test this. Do you want to try that? If this does not help, maybe add some code, that will read all available data and discard it *before* sending the first character. Cheers, Erich |