Newbie questions


I’ve been playing with RuuviTag for a week now and have some questions about it.

  1. Is it possible to compile and run nRF5_SDK_15.2.0_9412b96 examples to work with RuuviTag?
    I’ve copied the pca10040 directory for ble_app_uart example and messed with the Makefile and copied the compiler flags from ruuvi.firmware.c-project Makefile, but without success.

  2. Is there any minimal app example that can be run with RuuviTag?
    I’ve modified the ruuvitag_fw project and I have been able to run my own code with it, but since I don’t need all the stuff the firmware has. I’ve been thinking it would be nice to have some minimal template project as base to own implementations.

  3. Is it a known problem that after enabling BLE UART service to ruuvitag_firmware, the hardware resets itself when sending messages over 20 bytes from Android app?

Thanks for your help!

Yes, with some caveats. You’ll need to erase the bootloader and flash the new softdevice in the tag, so a wired connection is almost a must. In a pinch the bootloader and softdevice can be uploaded with DFU.

The SDK examples do not initialize sensor GPIO pins, and if the chip selects and SPI are left floating you’ll have excess power consumption.

SDK examples are my starting points, if you’re working with SDK15 you might be interested in Ruuvi Blog and fork off the project at some convenient point

Yes, the BLE UART service can handle only 20 byte chunks.

Thanks for very quick response!

I’ve tried flashing those examples with nrfjprog without success the following way:

nrfjprog --family nrf52 --eraseall
nrfjprog --family nrf52 --program <path/to/softdevice/hex>
nrfjprog --family nrf52 --program <path/to/example/hex>
nrfjprog --family nrf52 -r

Device gets flashed, but debug shows " app: Fatal error"

Flashing the full hex of self-compiled ruuvitag.firmware.c works, so SDK 15.2 stuff seems to work with my device.

To me crash when sending over 20 bytes to BLE UART seems like a bug. I understand the message could be truncated or error raised, but cannot see crash as a feature and was hoping this is because SDK 12 or softdevice 3 thing and fixed to SDK 15 and softdevice 6. But of course this is not in your hands, just asking if this is known issue since this kind of crash might prevent using the hardware for more demanding implementations.

Thanks, I’ll read the Ruuvi Blog

This looks ok to me, maybe you could debug the error with SES to find out what exactly is the issue?

My guess is that this could be handled on application side gracefully, and it’s just not done right now.

I’ll try that.

Ok,so it’s possible that ruuvitag_fw is not handling the messages correctly since it never reaches the nus_data_handler when message over 20 bytes is sent over BLE UART?

Thanks. I’ll keep testing and learn how to debug with SES. The most important thing for me was to know it should work and I’m not just banging my head to wall for no reason :slight_smile:

I think the most probable cause for crash is that there is no check for incoming data length and it overflows the 20-byte buffer. GATT on RuuviTags has been used mostly on various demos and proof-of-concepts, so you can expect a lot of rough edges there.

Example projects seem to be working with SES. I must have made some mistake when compiling/flashing from commandline. The 20 byte barrier doesn’t seem to be problem either. Thanks again for you tips. Seems like this hardware can do the things I would like it to do :+1: