PIC24FJ256GB106
We are driving a pair of LED's with Port B bits B13 and B14. The LED's are a simple operational mode indication. Sourcing about 4 mA per pin.
We have been through checking all of the alternate functions of Port B13, Configurations etc without getting any closer to solving our problem.
Occasionally, and usually after a minute or two of being powered down the B13 Mode LED does not light. There is NO port drive ( confirmed with a scope AND DVM ) B14 works just great.
We are setting the port TRIS bits to output at boot and leaving them that way.
Port bits are manipulated using the MCC generated macros
#define LED_R_SetHigh() _LATB13 = 1;
#define LED_R_SetLow() _LATB13 = 0;
#define LED_G_SetHigh() _LATB14 = 1;
#define LED_G_SetLow() _LATB14 = 0;
Then we modified stuff to set the pin high, read the pin and if it's low when we expect it to be high go through a bunch of stuff to re-iniitalize the port etc. Non of which works.
#define LED_R_SetHigh() { TRISBbits.TRISB13 = 0;_LATB13 = 1; printf("1"); if (_RB13 == 0) { AD1PCFGH = 0x0003; TRISBbits.TRISB13=1; TRISBbits.TRISB13=0;_LATB13 = 1; PORTBbits.RB13 = 1; AD1PCFGLbits.PCFG13 = 1; ODCBbits.ODB13 = 0; CTMUCON = 0; printf("-"); __delay_ms(80);} }
Eventually after a little while ....... PortB 13 comes back to life. but not sure what is changing
Driving me nuts!