Use Timer Interrupt for Software Serial Comms

Moderator: Benj

Post Reply
medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Use Timer Interrupt for Software Serial Comms

Post by medelec35 »

Would it be possible for the software serial e.g UART, SPI I2C etc use timer interrupts for better control?
It would be nice to be able to select timer as you can with PWM.
Currently If using software and interrupts fire then pulse stretching takes place.
Depending on the interrupt speed, data could easily fall outside allowed tolerances thereby causing corrupted chars.
For example, I'm using interrupts to detect the speed of two fans.
Unable to use hardware UART due to unable to modify hardware.
The faster the fans the more data corruption occurs.
What I have to do was pause the UART transmission enable interrupt, measure tacho for a short period, disable interrupt.
Use a multiplying factor, send UART etc.
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Use Timer Interrupt for Software Serial Comms

Post by Benj »

Hi Martin,

I like it, great idea. I'll get the cogs whirring and see if I can come up with an easy way to implement it :wink:

Post Reply