|
|
View previous topic :: View next topic |
Author |
Message |
championx
Joined: 28 Feb 2006 Posts: 151
|
Uart U1 PIC24EP512GU810 |
Posted: Wed May 20, 2015 3:02 pm |
|
|
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: 9245 Location: Greensville,Ontario
|
|
Posted: Wed May 20, 2015 3:23 pm |
|
|
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: 19549
|
|
Posted: Thu May 21, 2015 12:46 am |
|
|
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
|
|
Posted: Thu May 21, 2015 8:35 am |
|
|
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: 1357
|
|
Posted: Thu May 21, 2015 8:55 am |
|
|
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. |
|
|
|
|
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
|