Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Pic24ep512gu814 uart problem

Status
Not open for further replies.

anboli

Full Member level 2
Full Member level 2
Joined
Mar 9, 2012
Messages
144
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,298
Visit site
Activity points
2,513
Hi to Everyone,
Im new to PIC24EP512GU814 controlle, my doubt is how to configure the UART PINS in this controller. I saw the datasheet of this controller, in the PIN OUT diagram they mentioned some pins as PPS(Peripheral Pin Select). I dont Know which Pin is used as RX and TX? please help me to identify the TX and RX pin.... View attachment pic24Ep512GU814.pdf**broken link removed**

Thanks in advance...
 

Attachments

  • PIC24.gif
    PIC24.gif
    58.8 KB · Views: 82
Last edited by a moderator:

You need to read the PPS section, in particular pages 210 onwards. Inputs and outputs are mapped differntly which can be confusing. So, the UART receive pins are mapped using the registers on page 211 - RPINR18 and RPINR19. They can be mapped to any of the RPxx pins.

Output mapping is page 215 onwards.

I seem to think there are some RPxx pins that can only be inputs, not outputs, so the RX1 could be mapped to RPIxx but not TX1.

I also seem to remember I2C pins are fixed.

Keith
 
  • Like
Reactions: anboli

    anboli

    Points: 2
    Helpful Answer Positive Rating
RPINR18 = 0x0008; // Set up the UART Rx pin RP8 [17]
RPOR4 = 0x0300; // set up UART Tx pin RP9 [18]
 
  • Like
Reactions: GoldyIndia

    GoldyIndia

    Points: 2
    Helpful Answer Positive Rating
    V

    Points: 2
    Helpful Answer Positive Rating
RPINR18 = 0x0008; // Set up the UART Rx pin RP8 [17]
RPOR4 = 0x0300; // set up UART Tx pin RP9 [18]

You mentioned the Rx PIN RP8[17] and Tx PIN RP9[18]. number 17 and 18 is the pin number of the UART? if it is yes, there is no more RP8 and RP9 is not available in the Pin out diagram.. kindly send the Pin number of the 4 UART's(TX0 and RX0, TX1 and RX1, TX2 and RX2, and TX3 and RX3)..

- - - Updated - - -

You need to read the PPS section, in particular pages 210 onwards. Inputs and outputs are mapped differntly which can be confusing. So, the UART receive pins are mapped using the registers on page 211 - RPINR18 and RPINR19. They can be mapped to any of the RPxx pins.

Output mapping is page 215 onwards.

I seem to think there are some RPxx pins that can only be inputs, not outputs, so the RX1 could be mapped to RPIxx but not TX1.

I also seem to remember I2C pins are fixed.

Keith

from the PPS section i understand the RPxx is used for both I/O, and RPIxx is used only for Inputs....
i saw the input register, in that i got the RPINR18 and RPINR19, whether it is a Pin name or anything else.

i got more confusion in that selection of the Pin of UART'S, kindly help me in basic level.. it will most helpful for me..

Thanks.
 

please wait for some time i reply

- - - Updated - - -

Refer Page no 210 to 269 all detain mentioned & link http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en554310
 

The registers for UART1/2/3/4 receive are in table 11-1. If you want RX1 to be on RP127, which is pin 1 you set RPINR18 to 127. If you want it to be on RPI49 which is pin 10, you set RPINR18 to 49. I am not sure about
RPINR18 = 0x0008; // Set up the UART Rx pin RP8
as there is no RP8 on the PIC24EP512GU814 as far as I can see.

The choice of which pin to use depends on either physical - e.g. you want some pins on one side of the chip - or logical - e.g. you want to keep all 16 bits of one port free from some other use.

Keith
 

Anyway i found out the way to find UART pins with your big help.

Now i found all the 4 UART Tx and Rx pins, and myself assigned the TX and RX pin.

Could you kindly refer and tell me whether pin selection is correct or not..?

Function --- I/O PPS --------------------------------- Pin number

UART1:
RX --- RP67 --- U1RXR<6:0> (100 0011) ---- 111
TX --- RP66 --- RPnR<5:0> (00 0001) ---- 110

UART2:
RX --- RP126 --- U1RXR<6:0> (111 1110) ---- 138
TX --- RP125 --- RPnR<5:0> (00 0011) ---- 140

UART3:
RX --- RP109 --- U1RXR<6:0> (110 1101) ---- 57
TX --- RP108 --- RPnR<5:0> (01 1011) ---- 58

UART4:
RX --- RP97 --- U1RXR<6:0>(110 0001) ---- 127
TX --- RP96 --- RPnR<5:0>(01 1101) ---- 126

Thanks,
 

For TX1 you write 0b000001 to RP66R (you have said RPnR<5:0> ) and similarly for RP125, RP108, RP96 etc.

The RX1 looks right but for the others it is U2RXR<6:0>, U3RXR<6:0> etc not U1RXR<6:0>

Keith

- - - Updated - - -

I checked some of my old PIC24E code and found this:

Code:
	PPSUnLock;
	// need to set up RP36 at TX out - DON'T use library functions - the documentation is incorrect!
	RPOR1bits.RP36R = PPS_U1Tx;
	PPSLock;

which may be helpful. Also, don't forget to unlock the PPS to use it.

Keith

- - - Updated - - -

Not forgetting:

Code:
#define PPS_U1Tx 1			// doesn't seem to be defined already!

This was with the V1.00 XC16 compiler - they may have fixed some of the include files and documentation in the latest version (V1.11).
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top