SERIN2 Receiving Wrong Data


+ Reply to Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    414


    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.

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


    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

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


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    What is the clock of each PIC you use?

    Ioannis

  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

    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

  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

    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

  6. #6
    Join Date
    Aug 2011
    Posts
    414


    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.

  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 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.
    that can't be right because

    I know device A is sending the right data because I can see it with a logical analyzer.
    my next guess is that device A is running on 3Volts
    this guessing game has got longer legs than i expected
    Warning I'm not a teacher

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


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 Receiving Wrong Data

    Quote Originally Posted by tumbleweed View Post
    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.
    The PIC ports with HSEROUT and HSERIN are already taken. Using a baud rate of 9600 instead of 19200 made a difference. It is now working fine. The USB Darrel's interrupt takes micro seconds to execute. I measured it once. I forgot the exact number, but it was very small. That shouldn't affect the SEROUT/SERIN.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

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