SERIN2 Receiving Wrong Data


Closed Thread
Results 1 to 26 of 26

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    Tumbleweed, I had very strong suspicions that the issues were in the communication lines. I changed the Baud rate from 19200 to 9600 and I haven't got anymore wrong data at the receiver. I remember from my EE school days that the higher the frequency, the more prone to line noise the data is. So, by lowering the Baud rate it worked. I was pulling my hair out for a few days. At first I thought that it was some kind of SERIN2/SEROUT2 software issue.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  2. #2
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    By lowering the baud rate you're now allowing device B (and SERIN2) twice the time to receive the bits and assemble the byte.
    That's probably what's helping a lot more than any line noise issue.

    A software UART has a lot of potential timing issues, especially when it comes to receiving.

  3. #3
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    Quote Originally Posted by tumbleweed View Post
    By lowering the baud rate you're now allowing device B (and SERIN2) twice the time to receive the bits and assemble the byte.
    That's probably what's helping a lot more than any line noise issue.
    There is probably a little bit of both. I did a search in the forum, but couldn't find anyone having the same issue.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    What is the clock of each PIC you use?

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    Quote Originally Posted by Ioannis View Post
    What is the clock of each PIC you use?

    Ioannis
    The sending device has the typical 18F4550 USB setup and it is set to "Define OSC 48". The receiving device is set to "DEFINE OSC 16".
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    I guess then, the sending device is interrupted by the USB routines while sending and as a consequence the transmission of RS-232 at that time is corrupted.

    Ioannis

  7. #7
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    If you're using interrupts on either end then you shouldn't use SEROUT/SERIN as interrupts will upset the timing.
    You should use the hardware HSEROUT/HSERIN routines, but then you will have to use the dedicated UART IO pins.

    Also, you would be better off running the receiving end with a faster osc setting... try 32MHz instead of 16.

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

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