Flash and Authorize BN Series Modules

Last Updated on : 2023-11-21 03:45:07download

Overview

This topic describes how to flash firmware to the module and authorize its connection to the Tuya IoT Development Platform. Tuya provides two solutions for flashing and authorization.

  • Flashing and authorization combined: flash firmware and authorize modules using Tuya’s Cloud Module Burning Authorization Platform.

  • Flashing and authorization separated: flash firmware using the chip-specific flashing tool, and authorize modules using Tuya’s Cloud Module Burning Authorization Platform.

The first solution is intended for the release stage, while the second one is for development and debugging.

Applicability

This topic applies to BN series modules that have the nRF52832 chip at their core.

  • TYBN1 Datasheet

Flashing and authorization combined

Solution description

This solution is intended for the release stage. A module can connect to the Tuya IoT Development Platform after it is authorized.

The overall procedure:

  • Upload the firmware binary to the Tuya IoT Development Platform.
  • The platform generates a firmware key.
  • Flash the firmware and authorize the module using Tuya’s Cloud Module Burning Authorization Platform.

Hardware preparation

A USB to UART converter, a module built with nRF52832 (this topic uses TYBN1 module), and a circuit diagram.

Module pin USB to UART converter pin
IO18_D (TXD) RX
IO20_D (RXD) TX
VCC VCC3.3V
GND GND
Module pin J-Link pin
SWDIO SWDIO
SWC SWCLK
GND GND

Get the license

For more information, see Authorize Bluetooth LE Series Modules.

Flashing and authorization separated

Solution description

This solution is for development and debugging purposes. You can authorize the module once and then flash firmware to it multiple times. For modules that have been authorized, you only need to flash the updated firmware to them after you modify the code.

Firmware flashing

Connect the device and J-Link and select SWD as the target interface. If you get a screen as shown below, it means a hardware connection is successful.

Flash and Authorize BN Series Modules

Install the Nordic Semiconductor pack to Keil MDK.

  • Flashing process
  1. Flash the Nordic stack.

    Flash and Authorize BN Series Modules

  2. Flash the user firmware.

    Flash and Authorize BN Series Modules

  3. View logs with J-Link RTT Viewer.

    Flash and Authorize BN Series Modules

You can output logs through RTT. TY_LOG_ENABLE and TUYA_APP_LOG_ENABLE are used to enable/disable logging, which is disabled by default.

Flashing and authorization

  1. Open the chip flashing tool and flash firmware to the device.

  2. In the Cloud Module Burning Authorization Platform, enable Only Auth.

    Flash and Authorize BN Series Modules

  3. Click Run to authorize the module.