SPI and USART conflict question

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

Post Reply
garryp4
Posts: 126
Joined: Mon May 21, 2007 7:18 am
Location: Loveland, CO USA

SPI and USART conflict question

Post by garryp4 » Tue Jul 17, 2007 10:19 pm

The 18F4550 RC7 is both the USART TX and the SPI SDO. Can I 'include' both these with out any conflict? How much of a speed penalty does the software SPI cause? I am in the process of laying out a circuit so need to know before shipping off the gerber files. Any help is greatly appreciated.

Thanks.

TimB
Posts: 262
Joined: Wed Oct 04, 2006 7:25 am
Location: London UK

Post by TimB » Tue Jul 17, 2007 10:41 pm

In software its simply a mater of checking a flag to tell the source of the interrupt, however you will confuse the poor pic with the use of both a Usart and a SPI on the same pin.

garryp4
Posts: 126
Joined: Mon May 21, 2007 7:18 am
Location: Loveland, CO USA

Post by garryp4 » Wed Jul 18, 2007 4:07 am

I will use the software SPI for the memory.

Thanks.

TimB
Posts: 262
Joined: Wed Oct 04, 2006 7:25 am
Location: London UK

Post by TimB » Wed Jul 18, 2007 7:08 am

Are you not going to confuse the device on the other end of the USART?

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Wed Jul 18, 2007 7:30 am

You really don't want to mix the two functions on the same pin. Look at using a different pin with software SPI connected to your external memory device. Writing to these devices usually takes a few ms, so I wouldn't worry too much about software SPI speed (although it is pretty good as it doesn't use indirect addressing)

Look at '24LC640.bas', located in the samples folder for pointers...

Post Reply