UART reads taking an excessive amount of time

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

Moderator: Benj

Zane
Flowcode v5 User
Posts: 195
Joined: Thu Sep 10, 2009 10:57 pm
Location: New Zealand
Has thanked: 91 times
Been thanked: 75 times
Contact:

UART reads taking an excessive amount of time

Postby Zane » Thu Jun 01, 2017 4:25 pm

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 2919 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 2919 times


Thanks

Zane

User avatar
LeighM
Matrix Staff
Posts: 1870
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 438 times
Been thanked: 625 times
Contact:

Re: UART reads taking an excessive amount of time

Postby LeighM » Fri Jun 02, 2017 2:21 pm

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: 1870
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 438 times
Been thanked: 625 times
Contact:

Re: UART reads taking an excessive amount of time

Postby LeighM » Fri Jun 02, 2017 3:16 pm

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

Zane
Flowcode v5 User
Posts: 195
Joined: Thu Sep 10, 2009 10:57 pm
Location: New Zealand
Has thanked: 91 times
Been thanked: 75 times
Contact:

Re: UART reads taking an excessive amount of time

Postby Zane » Tue Jun 06, 2017 8:58 am

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
These users thanked the author Zane for the post:
LeighM (Tue Jun 06, 2017 9:36 am)
Rating: 5.26%
 

Zane
Flowcode v5 User
Posts: 195
Joined: Thu Sep 10, 2009 10:57 pm
Location: New Zealand
Has thanked: 91 times
Been thanked: 75 times
Contact:

Re: UART reads taking an excessive amount of time

Postby Zane » Thu Jun 08, 2017 7:29 am

Hi Leigh,

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

Zane
These users thanked the author Zane for the post:
LeighM (Thu Jun 08, 2017 8:12 am)
Rating: 5.26%
 

User avatar
LeighM
Matrix Staff
Posts: 1870
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 438 times
Been thanked: 625 times
Contact:

Re: UART reads taking an excessive amount of time

Postby LeighM » Thu Jun 08, 2017 8:12 am

Thanks for testing and letting me know