This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: MPC555 serial receive drops bytes


>> With the exception fixed, I was still getting overruns so I 
>moved the 
>> code out of the DSR code into the ISR to improve latency. Since its 
>> only moving a byte out of a register, I thought it doesn't 
>really need 
>> a DSR.

>
>You have to be very careful here. You cannot call the 
>
>(chan->callbacks->rcv_char)(chan, (cyg_uint8)scdr);
>
>from ISR context. It has to be in DSR context. It will play 
>around with threads, unblocking readers etc, which can only be 
>done safely in DSR context.
>
>    Andrew

This was just something that I naïvely tried just to test if getting the latency down would be enough to fix the problem.
Thanks for pointing out that its not the correct thing to do from that context.

I had in mind that if it fixed the problem, then the ISR could be made to store the received byte somewhere until the DSR was called to process it, rather than waiting for the DSR to lift it out of the data register. As it happens the latency is still too much so this isn't the answer.

I neglected to mention that in Redboot the serial code works much better as you can upload using ymodem etc. 
I've not looked at the Redboot code, but I assume it stays in a very tight polling loop which is why it only occasionally drops bytes.

It seems that the processor is just not fast enough to process serial data in the way that is currently implemented, it needs more or less procedural code to do this without making use of idle line detection.

Just to re-iterate a previous question, is there any mechanism for reporting errors from a DSR? And if not should there be? Also is it considered to be a good or bad practise to have asserts in a DSR to catch unreported errors?

Steven

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]