SERIN2 Receiving Wrong Data


+ Reply to Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    654

    Default SERIN2 Receiving Wrong Data

    Hi, I have two devices communicating with SERIN2/SEROUT2. Device A, a PIC18F4550, sends data to device B a PIC16F19197. I'm receiving the data at device B using SERIN2, but like 1 out of 5 times I receive a wrong byte. I know that device A is sending the correct data because I can see the right data with my logical analyzer. So, the problem is with SERIN2.

    I placed a 10k resistor in series to prevent either device to send power to the other device when one of them is turned off. Do you think that this resistor is the problem?

    Code:
    'Code at device B, PIC18F4550
    SEROUT2 PORTB.7,32,[STR RFID_IN\7]
    
    'Code at device B, PIC16F19197
    SERIN2 PORTE.1, 32, 5, BOARDSEARCHFAILED, [STR ClockInDataArray\7]
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,824


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    Yes it could be a problem. Try with no resistor and see if the problem is in your code or just the lack of power on the link. Then try max 1K resistor.

    But without more details like, type of cable, length and most important your code on both PIC chips, it is not easy to address the issue.

    Ioannis

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,523


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    Are these PICs on the same PCB or on each end of a long cable?
    Cable (well PCB traces too of course) has capacitance, with a 10k resistor you're forming quite an RC-filter (relatively speaking) which slows down the rise and fall times of the signals.

    If you have a scope, compare the signal on the sending and receiving PICs respectively.

  4. #4
    Join Date
    Aug 2011
    Posts
    415


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    Another thing that could be causing problems is that SEROUT2/SERIN2 are software bit-banged (no hdw UART involved),
    so device B must be sitting waiting at the SERIN2 for the first start bit before device A begins transmitting, else the timing won't be correct.

  5. #5
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    654


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    I tried removing the 10k resistor and I'm still having the same problem. The PICs are in two different PCB boards. The serial communication is taking place over a 3ft cable. The cable has 2.5mm mono plugs connectors at the end. I'm using a Baud rate of 19200. I'm going to try 9600 to see if that helps.

    Each PIC has thousands of lines in code. I don't think there is a problem with the side sending the data because I can see the correct byte with the logical analyzer. The issue in in the receiving end.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,824


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    Your best shot would be to post your code...

    Ioannis

Similar Threads

  1. Replies: 6
    Last Post: - 19th August 2013, 11:22
  2. how to display data receiving from xbee to LCD
    By NURULHAIZA in forum mel PIC BASIC
    Replies: 2
    Last Post: - 19th November 2010, 21:24
  3. Sending/receiving data using Linx modules
    By Goat 403 in forum Serial
    Replies: 3
    Last Post: - 21st May 2009, 13:57
  4. Receiving and Transmitting Serial data at the same time
    By BobP in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th April 2007, 22:00
  5. Receiving data from more than one serial Port
    By PICtron in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th March 2005, 10:20

Members who have read this thread : 18

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts