digitalWrite not working
Posted: Thu Apr 07, 2022 6:41 am
I'm doing some pulse generator with a simple timer to drive the stepper driver (DRV8225), In the timer interrupt callback, the designated pin is toggled, but when I run the code the pin state has not changed, I put the LED pin, inside the interrupts and its work fine while the driver pin dose not change, following is the timer call back
```cpp
void ARDUINO_ISR_ATTR timerCBS0(){
portENTER_CRITICAL_ISR(&locks0);
digitalWrite(GPIO_NUM_17, !digitalRead(GPIO_NUM_17)); //no change
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); // has changed
portEXIT_CRITICAL_ISR(&locks0);
}
```
any tips really appreciated
```cpp
void ARDUINO_ISR_ATTR timerCBS0(){
portENTER_CRITICAL_ISR(&locks0);
digitalWrite(GPIO_NUM_17, !digitalRead(GPIO_NUM_17)); //no change
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); // has changed
portEXIT_CRITICAL_ISR(&locks0);
}
```
any tips really appreciated