PDA

View Full Version : Nano SocketLAN connection to PIC



LGabrielson
- 20th June 2012, 04:37
When connecting a Nano SocketLAN module to a PIC, should I use the hardware UART on the PIC itself, or use other I/O pins so I can use SERIN2/SEROUT2 and invert the signal?

Thanks

mackrackit
- 20th June 2012, 06:48
Depends if you want to use interrupts easily or not.

LGabrielson
- 20th June 2012, 15:25
What does that mean? Interrupts on a serial connection to a PC via the RS232 port, or interrupts via a serial connection to the SocketLAN? Just say what you mean. The point of my question was the polarity of the serial connection to the SocketLAN, but what are the interrupt considerations?

pedja089
- 20th June 2012, 15:48
If you use SERIN, frequent interrupt may cause problem while receiving data. If you use HSERIN you can use interrupt to receive, or interrupt can occur while receiving data, without any problem.
And when using SERIN if Rx pin is pulled low(eg when module is turned off), timeout will newer expire...

LGabrielson
- 20th June 2012, 16:45
If you use SERIN, frequent interrupt may cause problem while receiving data. If you use HSERIN you can use interrupt to receive, or interrupt can occur while receiving data, without any problem.
And when using SERIN if Rx pin is pulled low(eg when module is turned off), timeout will newer expire...

My immediate inclination was to try to use the hardware serial port, and use DT_INT RX_INT for the hardware interrupt, but because I don't have the flexibility of inverting the polarity of the in/out with the hardware uart, I was just looking for confirmation that, Yes, I do need inverters on the in and out before feeding the SocketLAN. My brain hadn't gotten around to interrupts yet, but know enough now to think about them right away. Thanks for your reply!

pedja089
- 20th June 2012, 16:57
Are you sure that you need inverter?
Hava look www.connectone.com/media/upload/SocketLAN_overview.jpg
It is TTL uart on both sides.
You need inverter or level converter if you trying to connect TLL and RS232.
By the way, some pic can invert hardware uart levels.

LGabrielson
- 20th June 2012, 17:30
Well, no, I'm not SURE, but I think so. For example, on the SocketLAN demo board the serial data just comes out of the LAN module, and goes through a MAX232 inverter/level shifter and out to the PC serial connection. The hardware uart on the PIC assumes that you're going through a similar driver IC (I think)... and if you're staying in the TTL world, that would mean an inverter only. I should get my SocketLAN today, so will just wait and set it up on the bench. At least I've decided to use the hardware serial port and the interrupt question has been answered. I'm just going to lay out a small motherboard for the SocketLAN. We'll just answer the inverter question today or tomorrow.

dhouston
- 20th June 2012, 17:54
When connecting to a PC it is necessary to both invert the logic and convert the voltage levels but when connecting to an embedded TTL device, there's no need for either as it outputs TTL levels with positive logic. You will need level conversion if your microcontroller is powered by +5V but that's far simpler than a MAX232.

LGabrielson
- 20th June 2012, 18:14
OK! The voice of authority! As long as the polarity of the PIC's hardware uart is right for the SocketLAN, life is good. I DO need level conversion from 5V to 3.3V and will use the SN74LVC2G07 with a pullup to the appropriate power supply on the outputs. Thanks to both of you.