UART reads taking an excessive amount of time

An area to discuss 32-bit PIC specific problems and examples

Moderator: Benj

Post Reply
Zane
Flowcode v5 User
Posts: 199
Joined: Thu Sep 10, 2009 10:57 pm
Location: New Zealand
Has thanked: 93 times
Been thanked: 76 times
Contact:

UART reads taking an excessive amount of time

Post by Zane »

Hi Ben,

I have found a problem when reading the UART that it takes an excessive amount of time. The chip i am using that i am having problems with is a 32MX270F256B.

I have driven two outputs, one is connected to the brown trace and monitors the cycle time of the main loop, toggling every program cycle. The red trace is in the interrupt routine that is activated when UART receives data. The output turns on at the start of the routine and is turned off at the end of the routine.
I have used the same program in each instance, running one on a 18F26K80 and the results are shown below. To read a byte from the UART takes 64uS. After this the program reverts back to processing the main loop again until the next byte is availablein approx 1ms time.
8 Bit.jpg
8 Bit.jpg (24.53 KiB) Viewed 8031 times
The other is when it is run on a 32MX270F256B. To read a byte takes just over 1mS. The main loop is not processed at all until the serial port becomes idle again.
32 Bit.jpg
32 Bit.jpg (28.36 KiB) Viewed 8031 times
Thanks

Zane

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: UART reads taking an excessive amount of time

Post by LeighM »

Thanks, sorry, I read this last night, then forgot to pick it up today.
I'll take a look.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: UART reads taking an excessive amount of time

Post by LeighM »

Could you please try with the attached FCD?
Thanks,
Leigh
32MX270F256B.fcdx
(52.73 KiB) Downloaded 249 times

Zane
Flowcode v5 User
Posts: 199
Joined: Thu Sep 10, 2009 10:57 pm
Location: New Zealand
Has thanked: 93 times
Been thanked: 76 times
Contact:

Re: UART reads taking an excessive amount of time

Post by Zane »

Hi Leigh,

Thanks for your efforts. I have a fair bit on but will have time to look at this on Thursday and will get back in touch to let you know how it goes. :D

Thanks

Zane

Zane
Flowcode v5 User
Posts: 199
Joined: Thu Sep 10, 2009 10:57 pm
Location: New Zealand
Has thanked: 93 times
Been thanked: 76 times
Contact:

Re: UART reads taking an excessive amount of time

Post by Zane »

Hi Leigh,

I tried this update and it works fine now. Thanks for your help

Zane

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: UART reads taking an excessive amount of time

Post by LeighM »

Thanks for testing and letting me know

Post Reply