Author Topic: Assembled board with routing error, RS485 A/B swapped  (Read 3454 times)

0 Members and 1 Guest are viewing this topic.

Offline invzimTopic starter

  • Contributor
  • Posts: 22
  • Country: 00
Assembled board with routing error, RS485 A/B swapped
« on: September 09, 2012, 09:23:40 am »
I guess everyone does this once  ;).


I've had a 100 of these made, but unfortunately I made a mistake swapping two signals, as the SOIC-8  Eagle part in schematics was numbered 1,2,3,4,5,7,6,8 which I didn't catch before I got the boards back.  This is the A/B rs485 lines.

After facepalming for an hour, I googled this and it seems swapping A/B is a pretty common error, with a possible software fix.  RS485 is differential, so in theory just flipping the bits with an xor should do the trick. 

This is how it looks:
Working board:

Board with A/B swapped:

It indeed looks promising, but flipping the data didn't fix the leading edge, which was still in the wrong direction messing everyting up:

Bummer..

So my list of options is down to:
  • Cut the traces and solder on kynar
  • Ditch the boards, facepalm and pay up for new ones
  • OR, get new boards assembled but without the MCU and manually move these over
I'm crossing my fingers option 3 is cheapish, they should be able to use the same stencil and the MCU is by far the most expensive component. 

What do you guys think, am I too fuzzed about the cutting traces and doing wire rework?
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13987
  • Country: gb
    • Mike's Electric Stuff
Re: Assembled board with routing error, RS485 A/B swapped
« Reply #1 on: September 09, 2012, 09:38:15 am »
What baudrate are you using ? If not too high you could use a soft UART so you can invert in software.
A few UARTS  have polarity control, but I don't think PIC18 is one of them.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline invzimTopic starter

  • Contributor
  • Posts: 22
  • Country: 00
Re: Assembled board with routing error, RS485 A/B swapped
« Reply #2 on: September 09, 2012, 09:46:27 am »
I was actually not connecting the startbit with the waveform, or thinking about it at all - maybe this is fixable  after all :)
The baud is 115200 (and has to be) - I haven't done bit banging like this before, but will get on the startbit polarity asap. 
thanks!
 

Offline invzimTopic starter

  • Contributor
  • Posts: 22
  • Country: 00
Re: Assembled board with routing error, RS485 A/B swapped
« Reply #3 on: September 09, 2012, 10:55:58 am »
A few UARTS  have polarity control, but I don't think PIC18 is one of them.
The 18f is INDEED one of them.

Code: [Select]
REGISTER 20-3: BAUDCON: BAUD RATE CONTROL REGISTER
bit 5 RXDTP: Received Data Polarity Select bit
Asynchronous mode:
1 = RX data is inverted
0 = RX data received is not inverted
bit 4 TXCKP: Clock and Data Polarity Select bit
Asynchronous mode:
1 = TX data is inverted
0 = TX data is not inverted

Even had the registers defined in the C18 header files making this a 2 minute fix, what a relief!!  :) :) :)

BAUDCONbits.RXDTP = POLARITY;
BAUDCONbits.TXCKP = POLARITY;

If you like beer, PM me your address and I will see to it that some is delivered to you!
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2863
  • Country: au
Re: Assembled board with routing error, RS485 A/B swapped
« Reply #4 on: September 09, 2012, 11:41:05 am »
Ah, don't we all like a good result!   ;D
 

Offline Short Circuit

  • Frequent Contributor
  • **
  • Posts: 439
  • Country: nl
    • White Bream electronics R&D
Re: Assembled board with routing error, RS485 A/B swapped
« Reply #5 on: September 09, 2012, 12:53:46 pm »
Lucky man! Not often that you can cancel a hardware error this easily.
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4281
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Assembled board with routing error, RS485 A/B swapped
« Reply #6 on: September 09, 2012, 01:09:37 pm »
I've done it too, and on a commercial product - but fortunately the UART was implemented in an FPGA, so the fix was just as trivial.

The moral of the story is: not every device / vendor has the same relationship between A, B, +ve and -ve. Just because 'A' is the +ve half of the pair on one chip doesn't mean it'll be the same on some other chip.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf