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

Uart U1 PIC24EP512GU810

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



Joined: 28 Feb 2006
Posts: 151

View user's profile Send private message

Uart U1 PIC24EP512GU810
PostPosted: Wed May 20, 2015 3:02 pm     Reply with quote

Hi all! im using a PIC24EP512GU810, and im testing the UART1 but i can not receive data with it.


Code:
//Pinselect de la UART U1
#pin_select U1TX=PIN_F8
#pin_select U1RX=PIN_F2


Code:
#use rs232(baud=9600, xmit=PIN_F8, rcv=PIN_F2 , STREAM = U1 ,errors)


But i can not get any data, i can transmit but i cant receive. I tested the other uarts and works fine.

Any hint?

Compiler 5.042

thanks!
temtronic



Joined: 01 Jul 2010
Posts: 9216
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed May 20, 2015 3:23 pm     Reply with quote

OK, I don't use them but...
...any chance another peripheral is on that pin ?
With 'most' PICs you have to disable all other peripherals to 'dedicate' a pin to a peripheral.

..maybe look at the listing to 'confirm or deny' that the correct pin has been selected. There might be a 'bug' in that version of the compiler.


I know, you've probably thought of these ideas but......


Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19480

View user's profile Send private message

PostPosted: Thu May 21, 2015 12:46 am     Reply with quote

Also, _don't use the pin names in the #USE RS232_.

When using 'selectable pins', the sequence that works, is:
Code:

//Pinselect de la UART U1
#pin_select U1TX=PIN_F8
#pin_select U1RX=PIN_F2   
   
#use rs232(baud=9600, UART1, STREAM = U1 ,errors)


You set the pins to the peripheral with the select statements, and then tell the #use to use this peripheral. This sequence seems to be the 'reliable' way of doing this. Using the pin names, sometimes does not work.

As a comment, I've found that on some chips at least, the '5v tolerant' input pins, which are meant to have the same Vih as the other pins, often seem to have a slightly higher Vih. Using 3.3v logic into these pins, fed from some circuits, I had to add pull-up resistors to ensure a 'high' was reliably seen...

Also, obvious comment, have you actually tested each pin works for I/O to your test connections, _before_ trying to get the UART working?.
championx



Joined: 28 Feb 2006
Posts: 151

View user's profile Send private message

PostPosted: Thu May 21, 2015 8:35 am     Reply with quote

Hi temtronic and Ttelmah, yes i tested the pin as output jus to ensure that is working. I will test the pullup resistor and test it as input.

Tha thig that bothers me is that i use the other 3 uarts of the chip and the are working fine without any additional consideration.

Ill let you know!
jeremiah



Joined: 20 Jul 2010
Posts: 1342

View user's profile Send private message

PostPosted: Thu May 21, 2015 8:55 am     Reply with quote

When you tried the other UARTS, did you try them on the same pins or on different pins?

There are possible different issues to track:
1. Is there a hardware consideration for the pins not working (Are the pins bad, are they blocked by another peripheral, etc.)

2. Is there a compiler bug with UART1

If UART2 works on different pins, try it on the same pins you use for UART1 (without using UART1). See if UART2 works on those pins. If it does, then it is time to look at the LST file for each scenario and compare to see why UART1 doesn't work. If it doesn't work with UART2 on those pins, then try remapping other peripherals to those pins and see if those work.
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