0
\$\begingroup\$

I'm working on a device that uses the Sparkfun Artemis (specifically the Nano at the moment) to count the number of times a wheel spins, using a UART based proximity sensor. The device is meant to collect data while BLE is not connected, then transmit the data on request when the user connects to the device via BLE and signals to request said data.

I've worked with the Artemis on other projects, and this problem is one I can't recall seeing before. Basically, while I'm connected to the Artemis over nRF connect, the signal will drop at random and the Artemis doesn't seem to notice. I can't reconnect to it because the Artemis still thinks it's connected, which I confirmed by having an LED toggle on and off based on whether or not the Artemis is connected to a device. After the connection fails, the LED remains on.

I'm working in the the ArduinoIDE at the moment (1.8.13) and using the ArduinoBLE library (ver 1.2.2). If I try to go to version 1.3 or higher, everything breaks when I try to compile the code. Has anyone run into a similar error and/or have a suggestion as to what's going on?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ There's no schematics and you are using Arduino libraries. Should this be in Arduino.SE? \$\endgroup\$
    – Justme
    Commented Sep 25, 2023 at 16:11
  • \$\begingroup\$ @Justme I didn't include schematics because as far as I can tell, this isn't a schematic problem. Aside from this one BLE problem, it's all working fine. Wait, you're thinking hardware could be interfering with BLE signal or something? \$\endgroup\$
    – E.HP.S
    Commented Sep 25, 2023 at 16:28
  • 1
    \$\begingroup\$ Well if you are sure it's not a schematic problem, then it may be a software problem or how you wired the module to somewhere. I just tried to rule everything out one by one. I guess you have also ruled out the power supply too? \$\endgroup\$
    – Justme
    Commented Sep 25, 2023 at 16:34
  • \$\begingroup\$ @Justme Looks like it so far. Near as I can tell, the device just keeps going on like normal even after the connection is lost. I just can't reconnect to it after the fact. It's like I'm water-skiing and and lost my grip, and the boat hasn't noticed I'm not there anymore and kept going like normal \$\endgroup\$
    – E.HP.S
    Commented Sep 25, 2023 at 16:41

1 Answer 1

0
\$\begingroup\$

Welp, I'm an idiot. The problem was being caused by one of the measures I took to prevent the UART from getting stuck in case of missing a byte from the connected sensor.

Basically, I was waiting to see if something showed up in the buffer and if it didn't, increment a count. Once the count reached a certain minimum value, just quit out and try again, if it still fails then let me know, etc. Naturally, when I was making some revisions, I forgot that I'd declared the count as an 8-bit integer and was asking it to count up into the 1000s, so of course it wasn't going to work when a character went missing.

I've adjusted the minimum to be 255 (which is what I originally wanted it as before I ran into other (since resolved) issues and forgot to change to 255 when I switched the variable back to uint8_t), and so far everything is running perfectly.

Let that be a lesson to triple check your variable declarations and the values you want them to reach...

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.