NB-IoT GPS Tracker running on the Ghostyu NB-EK-L476 Developer Kit with STM32L476RCT6 microcontroller, Quectel L70-R GPS module and Quectel BC95 NB-IoT module. Photo taken during the field test at Berlayer Creek Boardwalk in Singapore.

Install Apache Mynewt and Embedded Rust for STM32 L476 and Visual Studio Code on Windows

Install Rust

rustup default nightly
rustup update
rustup target add thumbv7m-none-eabi
rustup target add thumbv7em-none-eabihf
rustc -V

Install Source Files and Build The Firmware

Flash The Firmware

Run The Program

Rust Source Files

Optional: Install Rust Language Server

Optional: Program Settings

syscfg.vals:
###########################################################################
# CoAP Server Settings
# CoAP host e.g. 104.199.85.211 (for coap.thethings.io)
COAP_HOST: '"104.199.85.211"'
# CoAP UDP port, usually port 5683
COAP_PORT: 5683
# CoAP URI e.g. v2/things/IVRiBCcR6HPp_CcZIFfOZFxz_izni5xc_KO-kgSA2Y8 (for thethings.io, the last part is the Thing Token)
COAP_URI: '"v2/things/IVRiBCcR6HPp_CcZIFfOZFxz_izni5xc_KO-kgSA2Y8"'
###########################################################################
# Network Settings
DEVICE_TYPE: '"l476"' # Device type that will be prepended to the Device ID. thethings.io converts the raw temperature depending on the device type.
NBIOT_BAND: 8 # Connect to this NB-IoT band
SENSOR_NETWORK: 1 # Enable Sensor Network library
SENSOR_COAP: 1 # Send sensor data to CoAP server
COAP_CBOR_ENCODING: 0 # Disable CBOR encoding of CoAP payload
COAP_JSON_ENCODING: 1 # Use JSON to encode CoAP payload for forwarding to thethings.io
RAW_TEMP: 1 # Use raw temperature (integer) instead of floating-point temperature values, to reduce ROM size
###########################################################################
# Hardware Settings
HARDFLOAT: 1 # Enable hardware floating-point support for STM32L476RC
LOW_POWER: 0 # Disable low power support
UART_0: 1 # Enable USART2 for GPS module
UART_1: 0 # Disable USART1
UART_2: 1 # Enable USART3 for NB-IoT module
UART_2_SWAP_TXRX: 1 # Swap TX/RX pins for USART3 so that USART3 behaves like LPUART1
GPS_L70R: 1 # Enable driver for Quectel L70R GPS module
GPS_L70R_UART: 0 # Connect to Quectel L70R module on USART2
GPS_L70R_ENABLE_PIN: MCU_GPIO_PORTA(1) # GPIO Pin PA1 enables and disables the GPS module. Set to -1 for no pin.
BC95G: 1 # Enable driver for Quectel BC95-G NB-IoT module
BC95G_UART: 2 # Connect to Quectel BC95-G module on LPUART1 i.e. USART3 with TX/RX pins swapped
BC95G_ENABLE_PIN: MCU_GPIO_PORTA(0) # GPIO Pin PA0 enables and disables the NB-IoT module. Set to -1 for no pin.
ADC_1: 1 # Enable port ADC1
TEMP_STM32: 1 # Enable STM32 internal temperature sensor
HMAC_PRNG: 1 # Enable HMAC PRNG pseudorandom number generator
view raw syscfg-l476.yml hosted with ❤ by GitHub

Program Settings. From https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/l476/targets/stm32l4_my_sensor/syscfg.yml