Electronic – PIC32 Configure PPS for SPI CLK

pic

Well I'm struggling hard with this, been at it for 2 hours so far. I should have stuck to my TI parts 🙂

Anyway I have a board and I'm trying configure the PPS to bring the SPI peripheral out to the pins. Actually I'll use it in I2S mode.

So the part is a PIC32MX210F016B and the SCK pin is this: SCK2_PRB15 Physically connected to pin26. I can see that in the datasheet this is the SCK2 pin.

I've been trying to follow these plib examples I've found like so:

PPSOutput(3, RPB15, REFCLKO);

But it's not working. I understand that there are different peripheral groups, but I don't get how to find the group number from the datasheet. I have been reading it tonight and reading table 11-2 about port settings. I'm still not clear.

I'm also reading the PPS.h header file to try to understand the settings but I can't find anything about SCK in there. I did finally figure out by looking at the macro expansion what the PPSOutput function is trying to do, but I just don't know how to figure out the parameters for my part.

Anyone have any ideas?

Best Answer

If you look at page 21 of the datasheet, you will see that the row of pins for SCK2 does not have PPS listed for its pin assignments like the other pins do; rather it is connected to either pin 23, 26, 29 or 15 depending on the package. Therefore it is not reassignable.

The SDI2, SDO2, and \$\mathsf{\small \overline{\text{SS2}}}\$ pins are reassignable through the PPS mechanism.