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

Lord Grezington
Flowcode V4 User
Posts: 233
Joined: Wed Nov 02, 2011 11:15 pm
Has thanked: 18 times
Been thanked: 24 times
Contact:

Hardware VS Software serial

Postby Lord Grezington » Thu Mar 21, 2019 9:50 am

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: 1873
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 530 times
Been thanked: 1040 times
Contact:

Re: Hardware VS Software serial

Postby kersing » Thu Mar 21, 2019 8:27 pm

Rule of thumb: use hardware if possible. Less overhead and less chance of timing issues.
These users thanked the author kersing for the post:
medelec35 (Thu Mar 21, 2019 8:44 pm)
Rating: 5.26%
 
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8412
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2401 times
Been thanked: 3434 times
Contact:

Re: Hardware VS Software serial

Postby medelec35 » Thu Mar 21, 2019 8:47 pm

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.
These users thanked the author medelec35 for the post:
kersing (Thu Mar 21, 2019 9:07 pm)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Lord Grezington
Flowcode V4 User
Posts: 233
Joined: Wed Nov 02, 2011 11:15 pm
Has thanked: 18 times
Been thanked: 24 times
Contact:

Re: Hardware VS Software serial

Postby Lord Grezington » Fri Mar 22, 2019 10:28 am

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: 8412
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2401 times
Been thanked: 3434 times
Contact:

Re: Hardware VS Software serial

Postby medelec35 » Fri Mar 22, 2019 11:28 am

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Lord Grezington
Flowcode V4 User
Posts: 233
Joined: Wed Nov 02, 2011 11:15 pm
Has thanked: 18 times
Been thanked: 24 times
Contact:

Re: Hardware VS Software serial

Postby Lord Grezington » Fri Mar 22, 2019 12:26 pm

Yeah, just what I thought...

For this Dev board Rx is not needed.

Thanks Martin