Firmware for the fifth iteration of the LBNL Thermal Logger hardware. Some of this readme might be outdated.
# Build project
cd build
make
# Parallel build with 16 cores
make -j16
# Compile (16 cores), and flash
make flash -j16
# Wipe flash (usually not necessary)
make erase
# Clean compiler history "start fresh"
make clean
# Flash softdevice
make flash_softdevice
- sdk_config.h // NRF specific variables.
- NRF_LOG_ENABLED // disables/enables logging. Disable logging to enable low power mode
- user_config.h // Project specific variables
- Pin configurations
- SENSOR_COUNT // Number of sensors on the probe
- ADXL345_ACTIVE // Is the probe TMP117-only, or a combination of TMP117 and ADXL345?
- makefile //compiler instructions, include new .c and .h files here!
- thermal_logger_gcc.ld // linker script. You might need to change memory allocations here if your code grows too much
- nrf52832_xxaa.map // memory map. Can be useful for debugging if you want to locate errors
Debug logs are output via UART on pin XX. This is configured in sdk_config.h via NRF_LOG_BACKEND_UART_TX_PIN
The baud rate is 115200.
A bootloader has to be installed the first time a chip/dev board is used.
- Download latest “Interface MCU Firmware”
- Make sure dev kit is plugged in, then turn the Power switch off
- Hold the reset button and toggle the power switch on -A BOOTLOADER USB device should show up
- Drag and drop the “Interface MCU Firmware” file to BOOTLOADER
- Once the LED starts blinking, power cycle the dev board.
https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack
sudo dpkg -i JLink_Linux_<version>.deb
https://www.segger.com/products/development-tools/ozone-j-link-debugger/
https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads !!! Version 11 and 12 seem to throw errors on Mac OS (M1). Last working version is 10.3.1 (tested on Macbook M1)
- Add
<GCC root>/binto path (/etc/paths)- It's the folder containing
arm-none-eabi-gcc
- It's the folder containing
https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK
- Open
<NRF5_SDK>/components/toolchains/gcc/Makefile.posix- Update GCC_INSTALL_ROOT to /bin/
- Don't forget trailing slash!
- Update GCC_INSTALL_ROOT to /bin/
- Update GNU_VERSION (8.2.1 at time of writing this doc)
- Check with:
arm-none-eabi-gcc --version
- Check with:
Make sure to set the "NRF_SDK_ROOT" variable. This is how it is set on John's computer in my ~/.profile
export NRF_SDK_ROOT=/home/fitz/opt/nRF5_SDK_15.2.0_9412b96/
This is how it's set on Stijn's computer:
cd ~ //home directory
sudo nano .bash_profile
PATH=$PATH:/Users/stijnwielandt/gcc-arm-none-eabi-8-2018-q4-major/bin
PATH=$PATH:/Users/stijnwielandt/nRF-Command-Line-Tools_9_8_1_OSX/mergehex
PATH=$PATH:/Users/stijnwielandt/nRF-Command-Line-Tools_9_8_1_OSX/nrfjprog
export NRF_SDK_ROOT=/Applications/nRF5_SDK_15.3.0_59ac345
For Mac OS Catalina and later (using the zsh shell, which uses ~/.zshrc or .zprofile)
cd ~ //home directory
sudo nano .zprofile
PATH=$PATH:/Users/stijnwielandt/gcc-arm-none-eabi-8-2018-q4-major/bin
PATH=$PATH:/Users/stijnwielandt/nRF-Command-Line-Tools_9_8_1_OSX/mergehex
PATH=$PATH:/Users/stijnwielandt/nRF-Command-Line-Tools_9_8_1_OSX/nrfjprog
export NRF_SDK_ROOT=/Applications/nRF5_SDK_15.3.0_59ac345
https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools/Download
- Add
mergehexandnrfjprogfolders to path - Ensure nrfjprog is working:
nrfjprog --version
Allow downloaded apps in system preferences - security.
NRF SDK Error codes aren't always quick to track down, so here are a few:
| Code | Name |
|---|---|
| 0x3400 | BLE_ERROR_GATTS_INVALID_ATTR_TYPE |
| 0x3401 | BLE_ERROR_GATTS_SYS_ATTR_MISSING |
The watchdog timer resets the Bluetooth IC after 8 seconds unless cleared. The low frequency clock is used to keep track of the watchdog status. The built-in WDT module can't be used; if it's enabled on sleep we reset before a sample is take. If not enabled on sleep it never triggers, because the CPU is rarely active (even when connected over Bluetooth). It starts on wakeup, stops on sleep, and is cleared on:
- Bluetooth connection
- Bluetooth data received
- Every 3 seconds during full flash erase
- Every time a packet of samples is transfered over Bluetooth