SERIN2 Receiving Wrong Data


+ Reply to Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,821


    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

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,522


    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.

  3. #3
    Join Date
    Aug 2011
    Posts
    414


    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.

  4. #4
    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

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,821


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

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

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    There is no much code to show here. I know device A is sending the right data because I can see it with a logical analyzer. I know device B, like 1 out of 5 times, is reading some bytes wrong because I can see these variables values in an LCD. That makes me think that it is a problem with the line. I'm still troubleshooting.

    Code:
    'Code at device A, PIC18F4550
    SendData:
       pause 5
       SEROUT2 PORTB.7,32,[STR RFID_IN\7]    
    goto SendData
    
    'Code at device B, PIC16F19197
    ClockInDataArray        var byte[7]
    
    SERIN2 PORTE.1, 32, 5, BOARDSEARCHFAILED, [STR ClockInDataArray\7]
       hours_0 = ClockInDataArray[0]
       minutes_0 = ClockInDataArray[1]
       seconds_0 = ClockInDataArray[2]
       hours_1 = ClockInDataArray[3]
       minutes_1 = ClockInDataArray[4]
       seconds_1 = ClockInDataArray[5]
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,392


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    I'm still troubleshooting.
    alone, until you provide at least a minimal, complete and verifiable example [MCVE]

    posting useless snippets is a good example of a worthless bad example


    my guess for the nearest to the pot Calcutta is inadequate power supplies
    Warning I'm not a teacher

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 : 17

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