CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Multiple hardware uarts problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
yokos2271



Joined: 29 Apr 2008
Posts: 5

View user's profile Send private message

Multiple hardware uarts problem
PostPosted: Thu Oct 03, 2013 9:14 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Oct 03, 2013 10:57 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Oct 03, 2013 11:43 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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