18f4550 comm clarification and advice

picspiuart

Please excuse my ignorance. I need your advise and clarification on something. I'm using the 18f4550 and I'm a little curious about the communication protocols. I am not using the USB features. It has 1-EUSART, and 1 (SPI/I2C) comm. My question is, the EUSART and SPI seem to share pin26 (on the 40pdip). I need to use both. Is it normal for 2 comm protocols to share a pin and just toggle the config of that pin throughout the program?

Are the SPI devices on that line going to be confused at the UART data they see on it, and vice versa? How likely is it they could react to some signal from the other protocol? Or is it good practice never to dual-use such a pin and spec a chip with 2 separate protocol pin allocations?

Thank you.

Best Answer

It looks like the UART transmit line and the SPI data out line share a pin on that part. That happens sometimes. Some of the newer PICs have alternate pins for some of the peripherals, or have the remappable pin feature. The 18F4550 is a rather old part.

Trying to share the pin sounds like a lot more trouble than it's worth. Fortunately, SPI is very easy to do in firmware if you're the master. If this PIC needs to be a SPI slave, then you probably should use a different PIC. Otherwise, just do the master function in firmware. SPI is very simple, so that is easy to do. Since it's synchronous and you own the clock, it doesn't matter if the processor occasionally goes off to a interrupt routine or something.