Hot!Pin configuration problem for PIC32MM0256GPM048

Author
nagogam
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2017/12/02 11:02:35
  • Location: Switzerland
  • Status: offline
2018/03/13 09:10:28 (permalink)
0

Pin configuration problem for PIC32MM0256GPM048

Hi all,
 
I have a MCC project for the PIC32MM0256GPM048 uc at an advanced stage.
Recently I wanted to use a RB3 pin but it didn't work as it should. The following code
snippet shows the issue:
    IO_RB3_SetHigh();
    printf("TRISBbits.TRISB3 %u \n", TRISBbits.TRISB3);
    printf("PORTBbits.RB3 %u \n", PORTBbits.RB3);
    printf("LATBbits.LATB3 %u \n\n", LATBbits.LATB3);

    IO_RB3_SetLow();
    printf("TRISBbits.TRISB3 %u \n", TRISBbits.TRISB3);
    printf("PORTBbits.RB3 %u \n", PORTBbits.RB3);
    printf("LATBbits.LATB3 %u \n\n", LATBbits.LATB3);

 
The result is:
TRISBbits.TRISB3 0 
PORTBbits.RB3 1
LATBbits.LATB3 1

TRISBbits.TRISB3 0
PORTBbits.RB3 1
LATBbits.LATB3 0

 
The value on the PORT doesn't change at all. The same test works fine for another pin RB2.
When I connect the RB3 pin to the GND, it changes its value to 0 and the uc doesn't reset.
 
Does anyone know the reason why it is happening? On the PCB, there is nothing connected to the RB3 pin for the moment. It will be used for I2C temperature sensor, so I really need this pin.
Thanks.
 
Pragmas:
#pragma config SOSCHP = OFF // Secondary Oscillator High Power Enable bit->SOSC oprerates in normal power mode.
#pragma config ALTI2C = OFF // Alternate I2C1 Pins Location Enable bit->Primary I2C1 pins are used
#pragma config FUSBIDIO = OFF // USBID pin control->USBID pin is controlled by the USB module
#pragma config FVBUSIO = OFF // VBUS Pin Control->VBUS pin is controlled by the USB module

// FICD
#pragma config JTAGEN = ON // JTAG Enable bit->JTAG is enabled
#pragma config ICS = PGx2 // ICE/ICD Communication Channel Selection bits->Communicate on PGEC2/PGED2

// FPOR
#pragma config BOREN = BOR3 // Brown-out Reset Enable bits->Brown-out Reset enabled in hardware; SBOREN bit disabled
#pragma config RETVR = OFF // Retention Voltage Regulator Enable bit->Retention regulator is disabled
#pragma config LPBOREN = ON // Downside Voltage Protection Enable bit->Low power BOR is enabled, when main BOR is disabled

// FWDT
#pragma config SWDTPS = PS1048576 // Sleep Mode Watchdog Timer Postscale Selection bits->1:1048576
#pragma config FWDTWINSZ = PS25_0 // Watchdog Timer Window Size bits->Watchdog timer window size is 25%
#pragma config WINDIS = OFF // Windowed Watchdog Timer Disable bit->Watchdog timer is in non-window mode
#pragma config RWDTPS = PS1048576 // Run Mode Watchdog Timer Postscale Selection bits->1:1048576
#pragma config RCLKSEL = LPRC // Run Mode Watchdog Timer Clock Source Selection bits->Clock source is LPRC (same as for sleep mode)
#pragma config FWDTEN = OFF // Watchdog Timer Enable bit->WDT is disabled

// FOSCSEL
#pragma config FNOSC = FRCDIV // Oscillator Selection bits->Fast RC oscillator (FRC) with divide-by-N
#pragma config PLLSRC = FRC // System PLL Input Clock Selection bit->FRC oscillator is selected as PLL reference input on device reset
#pragma config SOSCEN = OFF // Secondary Oscillator Enable bit->Secondary oscillator (SOSC) is disabled
#pragma config IESO = ON // Two Speed Startup Enable bit->Two speed startup is enabled
#pragma config POSCMOD = OFF // Primary Oscillator Selection bit->Primary oscillator is disabled
#pragma config OSCIOFNC = OFF // System Clock on CLKO Pin Enable bit->System clock is connected to CLKO/OSC2 pin
#pragma config SOSCSEL = ON // Secondary Oscillator External Clock Enable bit->External clock is connected to SOSCO pin (RA4 and RB4 are controlled by I/O port registers)
#pragma config FCKSM = CSECMD // Clock Switching and Fail-Safe Clock Monitor Enable bits->Clock switching is enabled; Fail-safe clock monitor is disabled

// FSEC
#pragma config CP = OFF // Code Protection Enable bit->Code protection is disabled

 
I am using the following:
OS: Debian 9
MPLAB: v4.05
MCC: 3.45.1
Compiler: v1.44
Microcontroller: PIC32MM0256GPM048
 

Attached Image(s)

#1

3 Replies Related Threads

    timijk
    Super Member
    • Total Posts : 1199
    • Reward points : 0
    • Joined: 2007/11/26 00:30:07
    • Location: Taiwan
    • Status: offline
    Re: Pin configuration problem for PIC32MM0256GPM048 2018/03/13 12:46:46 (permalink)
    0
    Did you enable the I2C2 before calling IO_RB3_SetHigh?  If yes, the I2C2 peripheral will control the port output value.
    #2
    al_bin
    Super Member
    • Total Posts : 139
    • Reward points : 0
    • Joined: 2011/02/11 06:28:47
    • Location: 0
    • Status: online
    Re: Pin configuration problem for PIC32MM0256GPM048 2018/03/13 12:55:57 (permalink)
    5 (2)

    #pragma config JTAGEN = ON // JTAG Enable bit->JTAG is enabled

    Then RB3 is ....?

    Albert
    #3
    nagogam
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2017/12/02 11:02:35
    • Location: Switzerland
    • Status: offline
    Re: Pin configuration problem for PIC32MM0256GPM048 2018/03/14 01:16:51 (permalink)
    0
    al_bin

    #pragma config JTAGEN = ON // JTAG Enable bit->JTAG is enabled

    Then RB3 is ....?

    Albert


    Thank you Albert! It was exactly the root of the problem.
     
    However, I find a little bit confusing that the MCC doesn't show that there is a conflict between JTAG and other peripheral. Is there any reason for that or it's just a potential improving of the MCC?
     
     
    #4
    Jump to:
    © 2018 APG vNext Commercial Version 4.5