Hi,
I'm trying to use an nRF52840 Dongle to make measurements from 4 SMT172 temperature sensors.
I developed a proof of concept on an nRF52840 DK, where I connect all 4 sensors to pins 1.00, 1.01, 1.02, 1.03, and using TIMER0 capture tasks and GPIOTE interrupts on those pins, I manage to calculate the duty cycle of the PWM signal and eventually get 4 temperatures simultaneously.
Up to now, the program only reports its measurements through USB CDC ACM (I plan on sending the data over the air later).
On the DK, I can observe the 4 measurements being performed simultaneously, and independently by using e.g. screen on /dev/ttyACM0. By independently, I mean if I disconnect sensor 1 from pin 1.00, all 3 remaining sensors show normal readouts while sensor 1 is reported as "dead" : no signal detected on the pin 1.00. Same applies if I disconnect any sensor.
To test the program on the dongle, I used pins 0.13, 0.15, 0.17, 0.20 ; the rest of the program is the same as for the DK.
When I run the program on, the dongle with only one sensor connected to pin 0.13, I can observe normal readouts : sensor1=20 deg, all other 3 are shown as "dead"
When I connect the sensor on pin 0.15, I get strange readouts : sensor1 is having some erratic activity, sensor2=20 deg, and the other 2 are "dead".
By "erratic activity", I mean that the software detects some polarity toggling on pin 0.13 (while there's nothing connected to it) and tries to calculate a duty cycle from that
When I connect the sensor on pin 0.17, readouts become normal again : sensor1 and sensor 2 are shown as "dead", sensor3=20deg, sensor4 = dead.
So it seems that the PWM activity on pin 0.15 induces spurious "toggle" events on pin 0.13 !
All 4 pins are configured with PULLDOWN.
nrfx_gpiote_in_config_t config; config.sense = NRF_GPIOTE_POLARITY_TOGGLE; config.skip_gpio_setup = false; config.pull = NRF_GPIO_PIN_PULLDOWN; config.is_watcher = false; config.hi_accuracy = true; uint32_t err_code = nrfx_gpiote_in_init(pm->pin, &config, pm->handler);
Also, I noticed that if I connect anything to pin 0.13 (i.e. a simple wire, or a scope probe), erratic activities stop. Same if I approach a finger to the pin 0.13 ! The closer my finger, the less events detected !!
I soldered headers on all castellated pins of the dongle, and I put it on a breadboard. It is powered by the USB connection from my laptop.
I also tried to put the dongle on another area of the breadboard : same strange result.
What do you think may cause this behaviour, where pin 0.13 is affected by polarity toggling on pin 0.15 ??
Is my dongle wacky ? Could this be caused by my soldering the pins ? Is it a known flaw of the dongle ? Can you think of a bug in the program that would surface like this ?
Thanks for your feedback!
David