PIC32MX170F256B & 270F256B IOC port B problem
Posted: Fri Jan 14, 2022 7:04 am
Hello.
I have a PIC32MX170F256B FC8 project with 2 rotary encoders each using IOC. An IOC portA to read one and IOC portB to read the other but the portB interrupt don't work, tried all avail 2 pin combinations for the encoder on portB. Verified encoder is working.
Also tested FC8 with ONLY 1 interrupt = port B, same.
Tried a PIC32MX270F256B same result.
Lastly tried PIC24HJ128GP202 and this works perfectly with it's single IOC set to all 4 encoder pins.
Next looked at PIC32 C code with Port A interrupts set for A0 & A1; the change notice enable bits for A are in the CNENA register
CNENA = 0x83 | (0x7,<<8)) so this seems correct from the datasheet as "3" gives 1's for A1 & A0 (this register only requires the lowest 5 bits as there are only 5 pins on port A but 2 of these are for the crystal).
However for the other IOC on Port B
CNENB = 0x0 | (0x0,<<8)) so it is not setting any bits (showing 0x0 not 0x00?)
To try this only requires selecting the chip in FC8 adding a rotary encoder to port B and setting an IOC portB, so I haven't attached any code.
Could you have a look at this please as I am out of my depth?
regards
Paul McK
I have a PIC32MX170F256B FC8 project with 2 rotary encoders each using IOC. An IOC portA to read one and IOC portB to read the other but the portB interrupt don't work, tried all avail 2 pin combinations for the encoder on portB. Verified encoder is working.
Also tested FC8 with ONLY 1 interrupt = port B, same.
Tried a PIC32MX270F256B same result.
Lastly tried PIC24HJ128GP202 and this works perfectly with it's single IOC set to all 4 encoder pins.
Next looked at PIC32 C code with Port A interrupts set for A0 & A1; the change notice enable bits for A are in the CNENA register
CNENA = 0x83 | (0x7,<<8)) so this seems correct from the datasheet as "3" gives 1's for A1 & A0 (this register only requires the lowest 5 bits as there are only 5 pins on port A but 2 of these are for the crystal).
However for the other IOC on Port B
CNENB = 0x0 | (0x0,<<8)) so it is not setting any bits (showing 0x0 not 0x00?)
To try this only requires selecting the chip in FC8 adding a rotary encoder to port B and setting an IOC portB, so I haven't attached any code.
Could you have a look at this please as I am out of my depth?
regards
Paul McK