juliosilva
Super Member
- Total Posts : 250
- Reward points : 0
- Joined: 2004/04/26 09:47:58
- Location: Portugal
- Status: offline
Cable length to UART at 3V
Hello, I'm developing a system with two PIC's that needs bi-directional communication. They both work at 3V VCC, and I'll use UART at 9600bps. I'll use 6 wire, crossed cable (3x2 pair) (like CAT5U ethenet cable), with 1xGND paired with 1xTX, 1xGND paired with 1xRX, and 2 other pair with VCC (3V). So the same cable will have regulated 3V/GND and TX/RX. Is the best choice? What is the maximum cable length that I should use? Thanks for any tip, JS
|
Steven37
Super Member
- Total Posts : 347
- Reward points : 0
- Joined: 2008/08/29 05:20:14
- Location: South Australia
- Status: offline
Re:Cable length to UART at 3V
2012/05/11 07:30:42
(permalink)
Hi, If you are using RS232 line driver/receiver ICs (MAX3221 or similar) then the cable length can be several hundred metres. If you are not using RS232 line driver/receiver ICs but are just connecting the PICs USARTs together, I think you will have trouble getting it to work reliably at 9600 baud over 1/2 a metre. Regards Steve.
post edited by Steven37 - 2012/05/11 07:33:48
|
juliosilva
Super Member
- Total Posts : 250
- Reward points : 0
- Joined: 2004/04/26 09:47:58
- Location: Portugal
- Status: offline
Re:Cable length to UART at 3V
2012/05/11 08:41:40
(permalink)
Not using line driver, just two PIC's... I need it to be from 5 to 10mts...
|
WaltR
Super Member
- Total Posts : 3812
- Reward points : 0
- Joined: 2003/11/07 12:38:21
- Status: offline
Re:Cable length to UART at 3V
2012/05/11 12:06:55
(permalink)
juliosilva Not using line driver, just two PIC's... I need it to be from 5 to 10mts... Do yourself a favor and use line driver/receivers for that distance. Else just wire the PICs together and hope the data does not get corrupted. Also, beware on grounding issues.
|
juliosilva
Super Member
- Total Posts : 250
- Reward points : 0
- Joined: 2004/04/26 09:47:58
- Location: Portugal
- Status: offline
Re:Cable length to UART at 3V
2012/05/11 13:00:06
(permalink)
What do you suggest? MAX3232?
|
DarioG
Allmächtig.
- Total Posts : 54081
- Reward points : 0
- Joined: 2006/02/25 08:58:22
- Location: Oesterreich
- Status: offline
Re:Cable length to UART at 3V
2012/05/11 13:26:19
(permalink)
If you have to put drivers anyway, I'd suggest MAX485 to make it differential, and up to 1Km In my opinion, @9600 you can easily do 5-10mt, just beware of grounds (and maybe have some checksum)
|
juliosilva
Super Member
- Total Posts : 250
- Reward points : 0
- Joined: 2004/04/26 09:47:58
- Location: Portugal
- Status: offline
Re:Cable length to UART at 3V
2012/05/12 05:28:42
(permalink)
HI DarioG, Do you think I can get 5-10mts without drivers? Regarding the grounds what is your tips? Regards, JS
|
DarioG
Allmächtig.
- Total Posts : 54081
- Reward points : 0
- Joined: 2006/02/25 08:58:22
- Location: Oesterreich
- Status: offline
Re:Cable length to UART at 3V
2012/05/12 07:17:04
(permalink)
Yes it should work. As for ground, easiest method is to connect them together or even using the same power supply. Or, power them via batteries. It gets worse with switching power supply...
|
drh
26+ years
- Total Posts : 1071
- Reward points : 0
- Joined: 2004/07/12 11:43:22
- Location: Hemet, Calif. USA
- Status: offline
Re:Cable length to UART at 3V
2012/05/12 07:30:50
(permalink)
Since you are using a CAT5 cable, you might consider using an RS422 interface. Look at the MAX3080 and MAX3081 chips.
|
juliosilva
Super Member
- Total Posts : 250
- Reward points : 0
- Joined: 2004/04/26 09:47:58
- Location: Portugal
- Status: offline
Re:Cable length to UART at 3V
2012/05/14 05:56:51
(permalink)
DarioG Yes it should work. As for ground, easiest method is to connect them together or even using the same power supply. Or, power them via batteries. It gets worse with switching power supply... I'll be using the same power supply, I'll send +3V, GND, TX&RX. And will pair one twisted pair for TX-GND and other for RX-GND. So TX & RX will be paired with a GND each. and the VCC and GND on the board will be the same. drh, I'll also take a look at that, thanks. Regards, JS
|
cesardag
New Member
- Total Posts : 23
- Reward points : 0
- Joined: 2006/10/19 23:12:38
- Location: Lima, Peru
- Status: offline
Re:Cable length to UART at 3V
2020/08/21 12:57:54
(permalink)
I think an rg58 cable would be better if you want to use one way in short distances (maybe 10 meters). But of course, you will need to use two power supplies. RS232 is the most common, but RS485 will be better for longer distances since it is balanced. Hope not to be too late.
|
ric
Super Member
- Total Posts : 30280
- Reward points : 0
- Joined: 2003/11/07 12:41:26
- Location: Australia, Melbourne
- Status: online
Re:Cable length to UART at 3V
2020/08/21 15:12:09
(permalink)
cesardag I think an rg58 cable would be better if you want to use one way in short distances (maybe 10 meters). But of course, you will need to use two power supplies. RS232 is the most common, but RS485 will be better for longer distances since it is balanced. Hope not to be too late. Eight years later, I think this hope may be in vain.
To get a useful answer, always state which PIC you are using!
|
crosland
Super Member
- Total Posts : 2206
- Reward points : 0
- Joined: 2005/05/10 10:55:05
- Location: Warks, UK
- Status: offline
Re:Cable length to UART at 3V
2020/08/22 08:43:46
(permalink)
cesardag I think an rg58 cable would be better if you want to use one way in short distances (maybe 10 meters). But of course, you will need to use two power supplies. RS232 is the most common, but RS485 will be better for longer distances since it is balanced. Hope not to be too late.
Can either of those be made to stretch 8 years? I think you need a different physical interface and protocol for that.
|
mlp
boots too small
- Total Posts : 1006
- Reward points : 0
- Joined: 2012/09/10 15:12:07
- Location: previously Microchip XC8 team
- Status: offline
Re:Cable length to UART at 3V
2020/08/24 09:10:36
(permalink)
crosland Can either of those be made to stretch 8 years?
Run your cable to Alpha Centauri and back.
Mark (this opinion available for hire)
|
talash_me
New Member
- Total Posts : 1
- Reward points : 0
- Joined: 2020/07/18 23:00:28
- Location: 0
- Status: offline
Re:Cable length to UART at 3V
2021/01/13 21:28:26
(permalink)
I am facing the same issue when I connect micro-controllers it will loss data but the same code and circuit working with Modbus slave. I am using dspic33 and UART1, For transmission I used interrupt. clock #define FP 60000000 /* FP = (FOSC/2) */ #define BAUDRATE 9600 #define BRGVAL 389 ((FP/BAUDRATE)/16) - 1 U1MODEbits.STSEL = 0; // 1-Stop bit U1MODEbits.PDSEL = 0; // No Parity, 8-Data bits U1MODEbits.BRGH = 0; // Standard-Speed mode U1MODEbits.ABAUD = 0; // Auto-Baud disabled U1BRG = BRGVAL; // Baud Rate setting for 9600 U1STAbits.UTXISEL0 = 1; // Interrupt after one TX character is transmitted U1STAbits.UTXISEL1 = 0; U1STAbits.URXISEL0 = 0; // Interrupt after a character is received U1STAbits.URXISEL1 = 0; // // _U1EIP =6; // _U1RXIP = 5; // _U1TXIP = 4; //To enable UART reception using Interrupt IEC0bits.U1RXIE = 1; // Enable UART RX interrupt U1MODEbits.UARTEN = 1; // Enable UART
|
crosland
Super Member
- Total Posts : 2206
- Reward points : 0
- Joined: 2005/05/10 10:55:05
- Location: Warks, UK
- Status: offline
Re:Cable length to UART at 3V
2021/01/14 08:46:19
(permalink)
talash_me I am facing the same issue
Which issue? The answer is in the thread above. Which bit of the answer are you struggling with?
|