Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Old UART LOCKUP problem is back

(you are viewing a thread; or go back to list of threads)

Old UART LOCKUP problem is back (by David R)
Hi,
with all the testing I have been doing I have found the old problem of the UART locking up and never resetting is back.

It does it when rubbish is received by the uart.

I am running 886 chip I don't have any older chips to test
if it the new chips or across the board.

I will see if I can find some 876 somewhere to test.

Regards
David.
Thu Oct 29 2009, 03:53:46
(no subject) (by Jonathan Westhues)
Interesting. The generated code should still reset the UART when a framing or overrun error occurs, and I can't see any problems with that register or bit definition for the 'F886 or 7.

It would indeed be useful to know if that happens with the 'F876 too.
Thu Oct 29 2009, 04:01:49
(no subject) (by David R)
I have tested 876a and there is problem.
I went back to ld1.7 and recompile and there is problem.

It is A very bad problem as I have got 4 pics linked to gether with serial using A token type system, when power is applied all the pics send serial on start up and it locks the uart up totality on all the pics. I put an led output on the right hand side if the receive uart op and it is not even going logic high.

The data that seams to be locking it up is not an overflow??, but data that looks like this "90š>Søá$ #¦Â¾Hø90"
which is A blend of two or More TX at the same time.

I tried putting delay turn on before the receive uart op to delay the receiving till the data is clean but this did not help.

I can some times also simulate the problem by plugging in the serial halve way through send.

Hope this info helps,
Regards
David,
Thu Oct 29 2009, 06:05:10, download attachment uart_test_token_1_wire_01.ld
(no subject) (by Jonathan Westhues)
Can you try a simple program that just receives a single character on the UART (and turns an LED on or off, or whatever)?

If the problem is with the UART hardware getting stuck, then you should be able to reproduce the issue by generating a framing error, for example by sending data at the wrong baud rate, or unplugging and re-plugging the serial port while there is activity on that port.

I can't see any reason why the hardware should be locking up; I haven't changed that code recently, and it looks correct, and as far as I know it used to work. But I don't have any hardware to test it myself.
Thu Oct 29 2009, 06:33:11
(no subject) (by David R)
Hi Jonathan,
I have got this diagnosed.
The UART will have (framing error ?) and total lockup if the program cycle time is set faster then the UART Char time.
ie
with 9600 bps and 1.0ms cycle = Uart lockup.

with 9600 bps and 1.1ms cycle = Uart stable.

I hope this helps
Regards
David
Fri Oct 30 2009, 02:20:47, download attachment simple_uart_test.ld
(no subject) (by Jonathan Westhues)
Seems unlikely, but any chance that the attached new version helps? The only thing that I could see is that I reversed the order of checking for errors vs. reading RCREG from the datasheet method.

Does the problem occur only when invalid data get received, or does it occur in normal operation too? And when the program is stuck, does the red LED ever turn on?

If this doesn't help, then I'll have to find some real hardware and debug.
Fri Oct 30 2009, 03:06:23, download attachment ldmicro.zip
(no subject) (by David R)
The new program does not help.
The uart works fine until it receives bad data then stops.
When it stops the red led is out and does not flash.

Also this is vary cryptic but if I add A button before the uart receive (as per attach file) and I lock up the uart using bad data then.... open the contact and re close the contact nothing happens,...
If I open the contact and send good data then close the contact the red led gives A flash (on closing of the contact) and the UART is reset
(but only if good data is received wile the contact is open)

I thought this is that cryptic that I am scared to post it.

I also think that it is more unstable with .5ms scan time
Fri Oct 30 2009, 04:27:04, download attachment simple_uart_test.ld
(no subject) (by Jonathan Westhues)
That actually makes sense. The problem seems to occur when the UART receive instruction polls too frequently. With the contacts open, the rung-in condition for that instruction is false, so it doesn't poll during that time.

I've attached another new build to test. This version tests for FERR and OERR only when RCIF is true (vs. all the time before); perhaps that will fix the problem, or at least fail differently.
Fri Oct 30 2009, 05:04:25, download attachment ldmicro.zip
(no subject) (by David R)
That has fixed it I can't lock it up any more and the token ring system works now to.
Thanks vary much for working with me on this
Regards
David.
Fri Oct 30 2009, 05:24:26
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):