Hardware VS Software serial

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Lord Grezington
Flowcode V4 User
Posts: 283
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Hardware VS Software serial

Post by Lord Grezington »

Hi Everyone

Has anyone done any comparason testing between hardware and sofware serial protocols?

I am doing a layout for a prototype PCB and need to make a decision on which pins to use with SPI.

I am using a dsPIC30F3011 wit ha fast clock speed of 117964800.

Thanks

kersing
Valued Contributor
Valued Contributor
Posts: 1939
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Contact:

Re: Hardware VS Software serial

Post by kersing »

Rule of thumb: use hardware if possible. Less overhead and less chance of timing issues.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8925
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Hardware VS Software serial

Post by medelec35 »

kersing wrote:Rule of thumb: use hardware if possible. Less overhead and less chance of timing issues.
I totally agree with that.
Especially as interrupts interfere with software generated code, but not hardware generated code.
Martin

Lord Grezington
Flowcode V4 User
Posts: 283
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: Hardware VS Software serial

Post by Lord Grezington »

Thanks Guys

The problem that I have is that the 30F3011 only has one hardware SPI, and this happens to be on teh same pins as the UART channel 1 hardware. Again it just so happens that the RX TX pins for the UART channel 1 hardware is also PGD & PGC. I like the fact that UART channel 1 is on the PGC & PGD as I have ftdi cables made up to take the UART out for serial plotting data on the PC (fits on the ICSP header). But I need the SPI to contoroll the IC's on the dev board fairly consistantly.

Now, I like the 16bit MCU's as they are fast, the 30F3011 befasue it works @ 5V, and it is the only one I can find that has 40pins in a TH package (I use TH for dev boards as my SM soldering is poor).

Would you suggest that taking the above into account that I use the software SPI and hardware UART - mainly because SPI is synchronous and UART is asyncronous?

Thanks

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8925
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Hardware VS Software serial

Post by medelec35 »

Personally,
If can only use one with hardware, then it would have to be asynchronous.
With asynchronous, in theory it will be more affected by interrupts than synchronous.
So best to use UART for hardware, even more so if RX is required?
Martin

Lord Grezington
Flowcode V4 User
Posts: 283
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: Hardware VS Software serial

Post by Lord Grezington »

Yeah, just what I thought...

For this Dev board Rx is not needed.

Thanks Martin

Post Reply