Hi there,
I'm looking at porting (i.e. re-implementing) an Arduino project to the nRF52832 to take advantage of the s212 or S332 softdevices. This chip is a few orders of complexity higher than Arduino, so I expect I've got a steep learning curve ahead of me. This thread was originally going to be a request to help narrow down areas to focus learning on, however, I'm seeing some threads that suggest what I want to do may not be possible on nRF52, due to softdevice interrupts over-riding the interrupts available for use by applications. I'm seeing apparently conflicting threads, though.
The project is an AC power control circuit. I use a TRIAC to suppress the AC sinewave at zero cross for a configurable number of microseconds. This is North American 60 Hz current, so zero cross occurs every 8333-ish microseconds. The TRIAC requires a HIGH pulse of 20 or more microseconds (I use 40) to fire. The current solution uses an optocoupler to generate an interrupt at zero cross. The ISR configures a timer with compare interrupts, with compare register A set to the pre-determined delay 't' ( t < (8333-40) ) and compare register B to t+40 microseconds. The ISR for register A pulls the TRIAC trigger pin HIGH, and the one for register B drops it back to LOW, generating a 40 microsecond pulse.
The delay is calibrated to bicycle speed. The circuit is used to drive a fan, delivering higher power with higher bike speed, simulating wind. At the moment, I am capturing speed on a computer and sending it to the Arduino over USB. I'd like to instead source speed using an ANT+ softDevice on the nRF52832. If I get that working, I'd like to add on a smart phone app, sending configuration data to the fan driver over Bluetooth - so I'm looking at the s332 softdevice.
The existing solution seems to tolerate a variance of +/- 15 microseconds or so on the zero cross interrupt. So there may be some wiggle room for interrupts to be delayed, but I think missing interrupts altogether would wreak havoc.
I get the impression from some threads that this work might be delegated to PPI/GPIOTE, but the relevant examples still seem to rely on a Timer, which I understand would be still be competing with the Softdevice for interrupts? Thoughts? Am I snookered before I start (having already bought the DK :-( )?