Confused on Microchip's Peripheral Pin Select registers.

Thread Starter

spinnaker

Joined Oct 29, 2009
7,815
I am a little confused on Confused on Microchip's Peripheral Pin Select. Am I right in assuming that if I wanted RP10 as the INT1 pin, I would set RPINR1 to xA?

upload_2015-10-22_17-47-31.png
 

OBW0549

Joined Mar 2, 2015
2,984
Probably not. Somewhere in the data sheet following the section you showed, there should be a table, probably titled, "INPUT PIN SELECTION FOR SELECTABLE INPUT SOURCES" that gives the actual correspondence between PPS Input Register settings and the various RPx or RPIx pin designations. For the dsPIC33EP part I'm currently working with, in the datasheet there is a hyperlink to that table, immediately following the section you illustrated above.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,815
That is why I am confused. There is indeed a table but it only lists the various peripherals like SPI, EUSART, ECPP etc. It does not mention INT1 or INT2.

That table precedes the section I posted.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,815
Yeah thanks, I have seen that. What I am trying to do is figure out how to set the register.
 

OBW0549

Joined Mar 2, 2015
2,984
Look at the following document - full version of the device family rather than datasheet of individual device.
http://ww1.microchip.com/downloads/en/DeviceDoc/39711b.pdf

Section 12.4.1 says..
Yes, I'm aware of that. But when it says, "Pins that support the peripheral pin select feature include the designation, 'RPn', in their full pin designation, where 'RP' designates a remappable peripheral and 'n' is the remappable pin number," that does not mean that the 'n' in 'RPn' is the number that should be loaded into the PPS register; to translate 'RPn' into the actual PPS register load value you need to consult the table in the specific device data sheet, since the table is different for each chip.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,815
Yes, I'm aware of that. But when it says, "Pins that support the peripheral pin select feature include the designation, 'RPn', in their full pin designation, where 'RP' designates a remappable peripheral and 'n' is the remappable pin number," that does not mean that the 'n' in 'RPn' is the number that should be loaded into the PPS register; to translate 'RPn' into the actual PPS register load value you need to consult the table in the specific device data sheet, since the table is different for each chip.

As I posted above there is no table for INT1, just the traditional peripherals.

I was just about to wire things up and try it.
 

OBW0549

Joined Mar 2, 2015
2,984
As I posted above there is no table for INT1, just the traditional peripherals.
The table I referred to above is NOT a table specific to any peripheral or peripheral function; it is a translation table mapping between peripheral pin select register values (i.e., the number you should load into the PPS register) and RPn designations, and it applies to ALL remappable inputs. You can't just take the "n" in "RPn" and load it into the register.

Look again for the table, in the device data sheet (not the family reference manual); I guarantee you, it's there somewhere.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,815
Think I found it but not sure I understand it. How do I map RP0 for INT1?

upload_2015-10-22_21-5-39.png
 
Last edited:

Thread Starter

spinnaker

Joined Oct 29, 2009
7,815
Found a sample in the datasheet. Looks like I was correct.

RPINR1 = 21;// INT1 mapped to RP21 (RD4)
 

OBW0549

Joined Mar 2, 2015
2,984
All you can do is try it and see, I guess. Without knowing the part you're working with so I can look at its datasheet myself, I can't help you much.

All I know is that for the part I'm using (dsPIC33EP64GP502), it's not as simple as what you're describing: you have to go to the table (table 11-2 on p. 178 of the datasheet) to find the PPS register value for the the particular RP/RPI you're looking for.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,815
Now I can't get any of the pins working as a freaking input! ;) Works as an output just not as an input. I am sure it is something stupid, I have done this a hundred times.

This is what I see on 178

upload_2015-10-22_21-59-57.png
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,815
All you can do is try it and see, I guess. Without knowing the part you're working with so I can look at its datasheet myself, I can't help you much.

All I know is that for the part I'm using (dsPIC33EP64GP502), it's not as simple as what you're describing: you have to go to the table (table 11-2 on p. 178 of the datasheet) to find the PPS register value for the the particular RP/RPI you're looking for.
Should have mentioned the chip. This is a pic18f26J53. This is a strange one probably why I can't get the pin to work as a binary input. Probably something to do with disabling the analog.
 

OBW0549

Joined Mar 2, 2015
2,984
Should have mentioned the chip. This is a pic18f26J53. This is a strange one probably why I can't get the pin to work as a binary input. Probably something to do with disabling the analog.
OK, reading your datasheet I can see the source of the confusion: apparently, PPS is done a bit differently in the PIC18F and dsPIC33EP parts. For the PIC18F, you and GopherT are correct: the "n" in "RPn" is indeed the actual number you load into the RPINR register.

But in the dsPIC33EP part I'm using, that is not the case because there is an additional level of mapping in the form of that table I referred to, because the dsPIC33EP parts feature what Microchip calls "virtual connections" wherein peripheral inputs can be connected not just to RP/RPI pins, but also to the outputs of other peripherals on the chip without ever going through a pin. Hence the need for the translation table, because of all the extra choices.

Sorry for the confusion. You were talking about apples, and I was assuming oranges...
 
Top