Shop OBEX P1 Docs P2 Docs Learn Events
Suggestions for fast dual RS232 VP — Parallax Forums

Suggestions for fast dual RS232 VP

Jim BrainJim Brain Posts: 17
edited 2006-01-12 09:40 in General Discussion
I'm looking for suggestions for a fast dual RS232 VP implementation, or a single UART that I can modify

I've tried the ones available for dload here, and they're fine, but I'm pushing to get 115200 out of the dual, and 230400 out of the single.· I calculated my delays at 75MHz, and I'm not sure there's enough time.

I'm wondering if there are more streamlined versions out there.· I tried compliling the 3 times oversampling one on a web site somewhere, but It's written for a PIC assembler, and I could not get it compiled to try it with my SX-Key/SX-Tech.

My project is going to be GPLed after I finish, so I'd prefer GPL code, but if someone has a solution I can take ideas from and re-implement, that'd be OK as well.

I need enough extra time in the routines to do the control lines (DTR/DSR/CTS/DCD/RTS), so I'm a bit more worried about timing.

Jim

·

Comments

  • James NewtonJames Newton Posts: 329
    edited 2004-10-29 04:59
    http://www.sxlist.com/techref/ubicom/lib/io/osi2/serial/rs232_sx.htm

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    James Newton, Host of SXList.com
    james@sxlist.com 1-619-652-0593 fax:1-208-279-8767
    SX FAQ / Code / Tutorials / Documentation:
    http://www.sxlist.com Pick faster!



  • Jim BrainJim Brain Posts: 17
    edited 2004-10-29 15:37
    James, thanks. The DUART 0412 looks like a good bet. I'll have to test tonite.

    Not sure why I missed that page. I thought I checked your site during my research. Oh well.

    Jim
  • Jim BrainJim Brain Posts: 17
    edited 2004-10-31 09:00
    Well, it took two days, but I finally got DUART 0412 to run on the SX28 and the SX52 here. A list of changes:

    Took out the autobaud detection. It's nice, but I feel it's a niche thing, as you need to mandate the fist char sent.
    Added back in configuration and high speed operation for UART2 (it was hardcoded to 9600 bps)
    Fixed the code for production SX52 (the code was configured for SX52_ES)
    Moved a few things to create shortest path for 115,200 bps routes.

    As of now, both UARTs can run at 115200, and I think that's about as good as I am going to get.

    Jim
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2004-10-31 10:46
    Can you post this adapted code.

    Could save others a lot of headaches.

    regards peter
  • Jim BrainJim Brain Posts: 17
    edited 2004-11-01 15:56
    I intend to, as soon as I get it completely cleaned up. I need to make sure the defines still work, and move it back to the SX28 and doublechek I didn't mess anything up.

    Jim
  • James NewtonJames Newton Posts: 329
    edited 2004-11-01 18:15
    Thanks Jim, I think we all really appreciate your concern for releaseing bug free code. On the other hand, it has been my experience that releasing code to the public almost guarrenties that someone, somewhere will find a bug, error, etc... in it. I take it as a good way to stay humble. <GRIN> The best thing you are doing is releaseing new code, buggy or not, and that is what I, and I'm sure many others, really appreciate.

    Short version: Cool, but don't stress about the code being perfect, just release it, and thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    James Newton, Host of SXList.com
    james@sxlist.com 1-619-652-0593 fax:1-208-279-8767
    SX FAQ / Code / Tutorials / Documentation:
    http://www.sxlist.com Pick faster!



  • Jim BrainJim Brain Posts: 17
    edited 2004-11-03 08:16
    As promised

    Here is the code I have been working on

    I still need to move it back to the SX28 and make sure I have the bank stuff correct, but it compiles for the unit.

    A couple notes:
    1. I put the·uart baud rate detection code back in (and added the same code for UART2), but made it optional
    2. I created some 75bps to 115200bps tables for common clock/prescalar settings
    3. I gave the developer the option of inlining the UART VP code.· The original source had the transmit and receive code as subroutines, but 7 cycles per UAR can be saved by inlining.· However, inlining takes almost the entire first page, so some may not want this.

    Let me know if there are issues or suggestions for more fixes.· Planned enhancements:
    • Put conditionals around the RTS/CTS code (Right now it is commented out, as per the original source)
    • Make the 16550 bus stuff conditional, or separate it out into it's own file
    Jim
  • JavalinJavalin Posts: 892
    edited 2006-01-11 10:21
    Jim,

    I am doing a similar piece of code, based on the dual-uart available on the www.parallax.com/sx/downloads.asp page. This works ok running two uarts at 57600, but I get dropouts and issues running dual uarts at 115200 on a SX18 @ 50mhz.

    I notice in your code that you have timeings for 50 and 75mhz, and that that ISR seems only to implement a single UART in some situations??

    Can you confirm whether two uarts at 115200 can be run with a 50mhz clock, or whether this requires 75mhz.

    Cheers

    James
  • Jim BrainJim Brain Posts: 17
    edited 2006-01-12 05:45
    The code is set up to turn off one or both UARTs if they are not being used.

    The code also has a special code path for 115200 operation of both UARTs.·

    My code used a combination of the original fixed speed 19200 DUART code and added in the 115200 UART code pieces (twice).· I had 2 UARTs running at 115200 at 50MHz, but I did not do extensive testing.· YMMV.

    Jim
    ·
  • JavalinJavalin Posts: 892
    edited 2006-01-12 09:40
    Jim,

    Cheers. Coincedentally got mine working at 50mhz last night - got the baud rate start delay value wrong! DOH!

    James
Sign In or Register to comment.