|
|
View previous topic :: View next topic |
Author |
Message |
yokos2271
Joined: 29 Apr 2008 Posts: 5
|
Multiple hardware uarts problem |
Posted: Thu Oct 03, 2013 9:14 am |
|
|
Hi,
I'm trying to use two hardware UARTS , and i'm having some problems .
If i Have only one UART Enabled, UART2 works fine :
Code: | #use rs232(UART2,baud=57600,parity=N,bits=8,ERRORS,stream = U2) |
If i try this:
Code: |
#use rs232(UART2,baud=57600,parity=N,bits=8,ERRORS,stream = U2)
#use rs232(UART1,baud=57600,parity=N,bits=8,ERRORS,stream = U1) |
UART2 is not working anymore.
I use #int_rda2 and #int_tbe2 for UART2.
I suspect, that UART2 somehow defaults to software mode and maybe that is why RDA2 and tbe2 firing up.
Please help . And let me know if more info is needed.
MCU: 24HJ128GP510
Compiler Version: 5.010 |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1346
|
|
Posted: Thu Oct 03, 2013 10:57 am |
|
|
you're not showing enough code to get valuable help. At the least we would need to see the section of code that enables the interrupts, the interrupt service routines, and any main code that uses things from those.
Forum guidelines require that you supply a small completely compilable program (copy => paste => compile) that highlights the issue.
I have an idea or two about what you are doing wrong but without following the guidelines, it is difficult for us to help. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Thu Oct 03, 2013 11:43 pm |
|
|
The common cause would be not correctly using the streams in the interrupt handlers. With two UART's, the getc in the handler, has to become fgetc, for the correct stream. Otherwise the wrong stream my be read, and then the UART won't get cleared, result - hang.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|