0
\$\begingroup\$

This is an excerpt from the datasheet of the PIC32MZ EC Family concerning peripheral pin select output mapping:

enter image description here

I'm using the PIC32MZ2048ECG064. My question concerns RPB10. I would like to use RB10 as a general purpose IO port, and control it with TRISB10, LATB10 and PORTB10. However, nowhere in the right list I see a possibility to do this. All options are either 'reserved', 'no connect' or really a peripheral. At first I thought 0x0, the default value, would let me use the pin normally, but section 12.3.5 says:

A null output is associated with the output register reset value of '0'. This is done to ensure that remappable outputs remain disconnected from all output pins by default.

So if I understand correctly the default value is that the pin is unusable. Yet, the LATB10 bit exists, so there must be a way to use it.

How do I use a remappable pin as a 'normal' GPIO?


Here are my configuration bits:

#pragma config DEBUG =      OFF
#pragma config JTAGEN =     OFF
#pragma config ICESEL =     ICS_PGx1
#pragma config TRCEN =      ON
#pragma config BOOTISA =    MIPS32
#pragma config FECCCON =    OFF_UNLOCKED
#pragma config FSLEEP =     OFF
#pragma config DBGPER =     PG_ALL
#pragma config EJTAGBEN =   NORMAL
#pragma config CP =         OFF

/*** DEVCFG1 ***/

#pragma config FNOSC =      SPLL
#pragma config DMTINTV =    WIN_127_128
#pragma config FSOSCEN =    ON
#pragma config IESO =       ON
#pragma config POSCMOD =    OFF
#pragma config OSCIOFNC =   OFF
#pragma config FCKSM =      CSECME
#pragma config WDTPS =      PS1048576
#pragma config WDTSPGM =    STOP
#pragma config FWDTEN =     ON
#pragma config WINDIS =     NORMAL
#pragma config FWDTWINSZ =  WINSZ_25
#pragma config DMTCNT =     DMT31
#pragma config FDMTEN =     ON

/*** DEVCFG2 ***/

#pragma config FPLLIDIV =   DIV_8
#pragma config FPLLRNG =    RANGE_5_10_MHZ
#pragma config FPLLICLK =   PLL_FRC
#pragma config FPLLMULT =   MUL_44
#pragma config FPLLODIV =   DIV_32
#pragma config UPLLFSEL =   FREQ_24MHZ
#pragma config UPLLEN =     ON

/*** DEVCFG3 ***/

#pragma config USERID =     0xffff
#pragma config FMIIEN =     ON
#pragma config FETHIO =     ON
#pragma config PGL1WAY =    ON
#pragma config PMDL1WAY =   ON
#pragma config IOL1WAY =    ON
#pragma config FUSBIDIO =   ON

/*** BF1SEQ0 ***/

#pragma config TSEQ =       0xffff
#pragma config CSEQ =       0xffff
\$\endgroup\$

closed as off-topic by Keelan, Daniel Grillo, Ricardo, Dave Tweed Aug 24 '15 at 14:14

  • This question does not appear to be about electronics design within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ "So if I understand correctly.." - or does it just mean that no remappable pins are connected by default, and then you can use it as a normal IO pin. In other words, by default it is not connected to any remappable outputs. Easy enough to try it? \$\endgroup\$ – Roger Rowland Aug 17 '15 at 14:23
  • \$\begingroup\$ @RogerRowland it doesn't seem to work. But, this is my first experience with PIC32, so something else may be going wrong as well. This question is an attempt to exclude one possible problem. \$\endgroup\$ – Keelan Aug 17 '15 at 14:25
  • \$\begingroup\$ I could be wrong on this, but I think 0000 just means that no remapping is done, and the output is left connected to the data latch. \$\endgroup\$ – Spehro Pefhany Aug 17 '15 at 14:25
  • \$\begingroup\$ What are your CONFIG bits set to? Some other PIC32 users have left RB10 configured as JTAG (that's the TMS option). \$\endgroup\$ – Roger Rowland Aug 17 '15 at 14:28
  • 3
    \$\begingroup\$ I'm voting to close this question as off-topic because it was caused by a typographical code error that is unlikely to help others. \$\endgroup\$ – Keelan Aug 17 '15 at 23:20
1
\$\begingroup\$

I believe that you must disable all other peripherals on the pin before it is connected to the GPIO latch. From the datasheet, RB10 shares the pin with several other fixed peripherals (i.e. non remappable). The peripherals tend to have control precedence in the order that they are listed on the datasheet pinout:

pin 23: TMS/CVREFOUT/AN5/RPB10/PMA13/RB10

The datasheet also provides some information for configuring the pins for GPIO (page 238):

The ANSELx register has a default value of 0xFFFF; therefore, all pins that share analog functions are analog (not digital) by default.

The JTAG peripheral (TMS) must be disabled. The analog input (AN5) must be set to use the pin as a digital IO using the ANSEL register (the datasheet has instructions on how to do this: section 28, page 412). The remappable pin (RPB10) will need to be cleared (I believe this is the default state). Finally the Parallel Master port will need to be disabled (PMA13 is an address line).

\$\endgroup\$
  • \$\begingroup\$ Thanks, but: JTAG is disabled (see config values in the question), the PMP is disabled by default and for the rest I used the Harmony Configurator tool, so also the ANSEL register is cleared, and CVrefOut is not used. If you have any other ideas, please let me know. \$\endgroup\$ – Keelan Aug 17 '15 at 17:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.