Open ElijahBasile opened 2 years ago
@ElijahBasile Hi I'm dealing with the same issue. I have a nordic DK with a jlink on it so I can run the debugger in VS Code tho. However, after few tries, I've manage to keep the nano 33 ble working buy setting manually registers as they were set in nordic DK. Here is a snippet:
int k = 0;
void setup()
{
Serial.begin(9600);
NVIC_DisableIRQ(TIMER1_IRQn);
NVIC_DisableIRQ(TIMER2_IRQn);
NVIC_DisableIRQ(TIMER3_IRQn);
NVIC_DisableIRQ(TIMER4_IRQn);
NVIC_DisableIRQ(GPIOTE_IRQn);
NVIC_ClearPendingIRQ(GPIOTE_IRQn);
NRF_GPIOTE->CONFIG[0] = 0x00031B01; // pin P0.27, toggle, event mode, port 0
NRF_GPIOTE->INTENSET = 1UL;
NVIC_EnableIRQ(GPIOTE_IRQn);
}
void loop()
{
Serial.println(k);
}
extern "C" void GPIOTE_IRQHandler_v(void)
{
for (int i = 0; i < 8; i++) {
if (NRF_GPIOTE->EVENTS_IN[i] == 1) {
NRF_GPIOTE->EVENTS_IN[i] = 0;
k = i;
}
}
}
Problem is that if no pins are connected, board will keep going. However, if you change the state of pin P0.27, board will freeze.
Hello,
I noticed while working with the GPIOTE peripheral directly on the Arduino Nano 33 BLE through the NRF52840, there seems to be a conflict between the mbed OS and the peripheral's interrupts. I am seeking a clarification on why this may be the case, and if it is possible to utilize the GPIOTE peripheral on Arduino?
The below section of code (by itself) causes the Arduino Nano 33 BLE to freeze (likely a hardfault):
The code above was also completed after configuring the GPIOTE LoToHi for pins D2-D9 (two below). I have tested with the configuration and without the configuration. The pin assignments were done with the following pin assignments (one below) followed the Arduino Nano 33 BLE schematic here: https://content.arduino.cc/assets/NANO33BLE_V2.0_sch.pdf
The following lines I added below the above sections; however they do not have an impact on the crashing at the moment:
UPDATE 1:
I noticed another issue elsewhere where this coincides with attachInterrupt(). This may be helpful to establish some context. Issue: https://github.com/arduino/ArduinoCore-nRF528x-mbedos/issues/7 Proposed Fix: https://github.com/ohazi/ArduinoCore-nRF528x-mbedos Pull Request: https://github.com/arduino/ArduinoCore-nRF528x-mbedos/pull/10
UPDATE 2:
Additionally, is one places an NVIC_DisableIRQ() first (refer to code below). This will prevent the error; however, this still does not allow GPIOTE interrupt usage. Once the NVIC commands in the code block above are triggered after, the board freezes.
UPDATE 3:
I tried a workaround (triggering an interrupt instead through the EGU via a PPI/GPIOTE/EGU linkage) with similar results unfortunately. Below is my implementation. When the EGU3's interrupt is enabled, this causes the Arduino Nano 33 BLE to stall/freeze. The last function is called in setup and promptly causes the system to freeze (tested with Serial)