Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 2 months ago.
nRF52-DK interrupt from sensor (MPR121 or CAP1298) hangs
Hi,
i'm experiencing weird behavior that never happened before and i don't know what's happening. I have a touch shield for arduino based on MPR121 which is connected to nRF52-DK and i'm using Sam Grove MPR121 library (link on bottom).
This sensor worked flawlesly on my nRF51-DK and even on my custom nRF51 board but when i upload simple hello_world code (which worked and still works on other boards) to nRF52 and i touch buttons on shield, board freezes/hangs. I think that there is an issue with interrupts because i know that shield is connected properly because i get readings from registerDump function. Also i made a breakout board for microchip CAP1298 touch sensor which is similar to MPR121 but i got the same result - works on other boards without errors but on nRF52 when interrupt occurs app drops.
I also thought that library is not compatible with nRF52 so i used sensor interrupt to only toggle a led (without reading data from sensor) and my led never goes on because board hangs immediately on touch. Strangest of all is that normal button interrupt work without errors.
Am i doing something wrong? Did i missed something related to nRF52 interrupts? Thx
Import programMPR121_HelloWorld
Test program for capacitive sensing using the Freescale MPR121 on the Sparkfun SEN-10250 BoB
1 Answer
7 years, 10 months ago.
The comments about the library, what did you change? I have a micro:bit with a pi-cap and dump registers work but not interrupts. https://developer.mbed.org/users/owenbrotherwood/code/MPR121_HelloWorld_pi_cap_microbit/
Hi,
i made library for my sensor (CAP1298). It's based on Sam Grove code for MPR121. Maybe it's buggy but i didn't experienced any problems. I only moved i2c read commands from
void MPR121::handler(void) {}
to other routine and everything started to work normaly. Maybe it's not smart but it works.
Import libraryCAP12xx
Capacitive touch sensor (8 probes) by Microchip
Ok, i'm answering my own question here. Problem with sensor interrupts are in library. Library reads and writes to sensor registers in interrupt routine (reading which button was pressed and writes clear bit to interrupt register) and thats why board hangs on touch. I modified lib and now all works. Thx
posted by Filip Skorup 28 Sep 2016