Bluetooth LE–BK3431Q

Last Updated on : 2023-08-30 03:21:53download

This topic describes the basics of the chip platform used in TuyaOS development. For more information, visit Tuya Developer Forum.

Hardware environment

Datasheet

The datasheet can be found in hardware\bk3431q\chip_manual\BK3431Q Datasheet V1.3.pdf.

Development board

Development board from BEKEN.

Bluetooth LE–BK3431Q

Peripherals

UART

This platform has two UARTs. TuyaOS uses the UART listed below. The pin configuration is fixed and cannot be modified. The other UART (TX P16) is used for log output.

UART Feature Pin
UART0 TX P00
UART0 RX P01

SPI

This platform has only one SPI bus.

SPI Feature Pin
SPI0 CS P07
SPI0 CLK P04
SPI0 SDI P05
SPI0 SDO P06

I2C

This platform has only one I2C bus.

I2C Feature Pin
I2C0 SCL P02
I2C0 SDA P03

PWM

This platform supports 6-channel PWM output. The default PWM pins after initialization are shown below.

Channel Pin
0 P10
1 P11
2 P12
3 P13
4 P14
5 P15

ADC

This platform has eight pins for ADC multiplexing.

Channel Pin
0 P30
1 P31
2 P32
3 P33
4 P34
5 P35
6 P36
7 P37

Other pins used by TuyaOS

This platform has only one I2C bus.

Feature Pin Description
KEY P12 Wake-up pin
POWER_ON P10 Startup time detection pin, indicating the completion of initialization.

Software environment

Keil

  1. Download Keil from the Arm Keil website. mdk528a.exe is recommended. During installation, keep all the default settings.

  2. If you are prompted to install a driver, continue with Install.

  3. When opening Keil, if you are prompted to install a software pack, close the window.

  4. After Keil is installed, add the path of the UV4.exe file to the environment variable. For example: TUYAOS_COMPILE_TOOL: C:\Keil_v5\UV4, as shown below.

    Bluetooth LE–BK3431Q

Firmware flashing

Flashing guide

Path: hardware\\bk3431q\module_manual

Flashing tool

Path: pc\tools\bk3431q

Features

Startup time

  • Use a logic analyzer to measure the signal time difference between the VCC pin and the startup time detection pin.

  • Detection pins: peripheral → startup time detection pin

    Bluetooth LE–BK3431Q

Flash partition

Bluetooth LE–BK3431Q

Adjust flash partitions

In the original project, you can modify the following macros to adjust the default flash partitions.

// Flash
#ifndef BOARD_FLASH_BULK_DATA_START_ADDR
#define BOARD_FLASH_BULK_DATA_START_ADDR        (0x77000)
#endif

#ifndef BOARD_FLASH_TUYA_INFO_START_ADDR
#define BOARD_FLASH_TUYA_INFO_START_ADDR        (0x7B000)
#endif

// #ifndef BOARD_FLASH_OTA_INFO_ADDR
// #define BOARD_FLASH_OTA_INFO_ADDR               (0x7C000)
// #endif

#ifndef BOARD_FLASH_OTA_START_ADDR
#define BOARD_FLASH_OTA_START_ADDR              (0x44000)
#endif

#ifndef BOARD_FLASH_OTA_END_ADDR
#define BOARD_FLASH_OTA_END_ADDR                (0x64000)
#endif

#ifndef BOARD_FLASH_OTA_SIZE
#define BOARD_FLASH_OTA_SIZE                    (BOARD_FLASH_OTA_END_ADDR - BOARD_FLASH_OTA_START_ADDR)
#endif

#ifndef BOARD_FLASH_MAC_START_ADDR
#define BOARD_FLASH_MAC_START_ADDR              (0x7F000)
#endif

Power consumption

Measure the average power consumption of typical one-second advertising.

Bluetooth LE–BK3431Q