Hi all,
i'm using the pyboard for LIN communication, and it is working well so far. But i have some trouble with the uart itself. at some point it stops working! there is no error, the script is working and i get output over the repl, but i get no bytes over the uart. restarting solves the issue. is there a way to find out, where the problem could be?
thank you!
Oli
Uart stops working
Re: Uart stops working
since no one had an answer and in my application i had a lot of problems with stopping uart, i found the cause (hopefully). the USARTx_SR register did indicate an ORE flag, and then the .any() returned "false". so the application stopped. now, i check the SR register and if the ORE bit is set, i read, according to the manual of the stm32f405, first the SR and then the DR register. this seems to solve my problems...
Re: Uart stops working
Interesting. It seems that the default is to use a 64-byte buffer, which means that an interrupt handler is installed to transfer data from the HW to the buffer, so I wouldn't have expected ORE errors to be occurring.
Obviously, the driver needs to be improved a bit since it should self recover from that rather than "lockup".
Obviously, the driver needs to be improved a bit since it should self recover from that rather than "lockup".
Re: Uart stops working
hi,
i have the read_buffer_len set to "0", because i hve to receive the LIN-break and so the recv-flags must match the current received byte.
i have the read_buffer_len set to "0", because i hve to receive the LIN-break and so the recv-flags must match the current received byte.
Re: Uart stops working
ok - I would expect overrun errors when using a read buffer of zero.
Perhaps we need to widen the existing fifo to include the character statuses (like break, parity error, etc)
Perhaps we need to widen the existing fifo to include the character statuses (like break, parity error, etc)
Re: Uart stops working
that would definitly solve the problem. perhaps i can take a look into it...
Re: Uart stops working
I am now using the USB serial converter suggested by blmorris
http://www.adafruit.com/products/954
I have it connected to X1,X2 and Gnd. I am happy to say it is now generally working (after many driver install issues).
However, the shell.py program written by Dave (dhylands) will not work. When I type import shell to the terminal it kills REPL (no more communication). Dave's program is very helpful in viewing log files stored on the SD. If anyone has suggestions I would appreciate the assistance.
http://www.adafruit.com/products/954
I have it connected to X1,X2 and Gnd. I am happy to say it is now generally working (after many driver install issues).
However, the shell.py program written by Dave (dhylands) will not work. When I type import shell to the terminal it kills REPL (no more communication). Dave's program is very helpful in viewing log files stored on the SD. If anyone has suggestions I would appreciate the assistance.
Re: Uart stops working
I seem to recall having some issues with shell.py when using the HW UART.
You might want to try changing the repl = pyb.USB_VCP() line: https://github.com/dhylands/upy-shell/b ... ell.py#L35 to point to your uart instead. If that doesn't work, you can always uncomment the second implementation of term_size https://github.com/dhylands/upy-shell/b ... py#L48-L49 that hard codes a terminal size. The terminal height isn't used anywhere, and the only place that uses the terminal width is the ls command.
The code is sending a special escape sequence to your terminal and reading back the result. However this is problematic when the repl is being sent to 2 places (because then both places could reply), so I wound up having to hard code it to read from the USB REPL. Te way its coded right now, when you use the UART as a REPL it hangs waiting on the USB to reply .
The pyb.repl_source function that I proposed wasn't accepted, and I have on my todo list adding something called a "pluggable" REPL so that you can install your own REPL behaviour, but that hasn't happened yet.
You might want to try changing the repl = pyb.USB_VCP() line: https://github.com/dhylands/upy-shell/b ... ell.py#L35 to point to your uart instead. If that doesn't work, you can always uncomment the second implementation of term_size https://github.com/dhylands/upy-shell/b ... py#L48-L49 that hard codes a terminal size. The terminal height isn't used anywhere, and the only place that uses the terminal width is the ls command.
The code is sending a special escape sequence to your terminal and reading back the result. However this is problematic when the repl is being sent to 2 places (because then both places could reply), so I wound up having to hard code it to read from the USB REPL. Te way its coded right now, when you use the UART as a REPL it hangs waiting on the USB to reply .
The pyb.repl_source function that I proposed wasn't accepted, and I have on my todo list adding something called a "pluggable" REPL so that you can install your own REPL behaviour, but that hasn't happened yet.
Re: Uart stops working
What did work was enabling the commented out terminal size function.
Thanks Dave.
Thanks Dave.