[RTL8720CF] BW15 (module WiFi+Bluetooth) compilation and other operation notes

RTL8720CF

1. Program download

  • Open AmebaZ2_PGTool_v1.2.7.exe

  • Browse to select the corresponding firmware

  • Select the corresponding pin as PIN_B6_B12

UART2(GPIOA15,16)

Linux compilation:

1) Open a terminal

2)进入project\realtek_amebaz2_v0_example\GCC-RELEASE

3) Enter the command make all

0) Use the command make clean to clear the compilation generated files

2.5.1.2.2 Generate image binarization
After compiling, you can see images partition.bin, bootloader.bin, firmware is.bin and flash is.bin in different folders of \GCC-RELEASE
1)partition.bin Storage partition table, record the address of Boot image and firmware image; located in the folder \GCC-RELEASE;
2) bin is the bootloader image; located in the folder \GCCRELEASE\bootloader\Debug\bin;
3) Firmware is.bin is the application image ;Located in the folder \GCc RELEASE\application is \Debug\bin;
4) Flash is.bin links partition.bin, bootloader.bin and firmware is.bin. Located in the folder GCC-RELEASE\application_is\Debug\bin.
Users need to select flash is.bin when using the PG tool to download images to the board.

PIN
PIN_A7_A12 RTL8710CX/RTL8720CM
PIN B6 B12 RTL8720C6
  • console_init: The initialization of the log serial port, creating the AT command service thread of the log serial port, after the initialization is completed, you can send commands through the log serial port to achieve related functions. For the format and description of the log command set, refer to the AN0025 document in the doc folder of the SDK package.

  • wlan_network: Initialize the Lwip protocol stack.

  • example_entry: The entry function of the SDK function module, which enables or disables related functions by configuring related macro definitions, such as AT command set, Bluetooth GATT service, various cloud service demos, HTTP, etc.

Introduction to AT command set

There are two sets of AT command sets in the SDK, one is based on the log serial port, and the command interaction is carried out through the log serial port. The reference document is AN0025 in the doc directory. The other set is the instruction set of v2.0, which is based on the independent command serial port. The instruction set reference document is AN0075 in the doc directory. The two sets of instruction sets have different instruction formats.

The instruction set module is not enabled by default.

1. The configuration macro of the AT command set needs to be opened in the platform_opts.h header file, and the configuration is as follows:
#define CONFIG_EXAMPLE_UART_ATCMD 1

2. Configure the serial port parameters. The configuration code is in the uart_atcmd_main function of the example_uart_atcmd.c file. After the module is powered on, it will read and save the serial port parameters from FLASH for configuration. If the serial port parameters have not been set by commands, the default parameters will be used. The default parameters are as follows:

波特率:38400
数据位:8
校验位:无
停止位:1
硬件流控:关闭  

Note: Since the serial port has multiple multiplexed pins, the pins of the serial port should not conflict with other functional pins
. The configuration of the pins is in the header file example_uart_atcmd.h, and the configuration code is as follows:

#define AMEBAZ2 4  
#define AMEBAZ2 4
#define CONFIG_AMEBA AMEBAZ2
#if (CONFIG_AMEBA == AMEBA1 )
#define UART_TX PA_4
#define UART_RX PA_0
#define UART_RTS PA_2
#define UART_CTS PA_1
#elif (CONFIG_AMEBA == AMEBAZ )
#define UART_TX PA_23
#define UART_RX PA_18
#define UART_RTS PA_22
#define UART_CTS PA_19
#elif (CONFIG_AMEBA == AMEBAD )
#define UART_TX PA_18
#define UART_RX PA_19
#define UART_RTS PA_16
#define UART_CTS PA_17
#elif (CONFIG_AMEBA == AMEBAZ2)
#define UART_TX PA_14
#define UART_RX PA_13
#define UART_RTS NC
#define UART_CTS NC
#endif

3. Compile and download

4. Test (the command ends with \r\n)

ATPN=AA,12345678  

Connect to AA's wifi, the password is 12345678

AT command set development

The SDK integrates common commands such as networking, data transmission, and parameter setting. Users can also add their own commands according to actual needs.

1. Instruction Definition

To add an instruction, you need to define the instruction format and instruction execution function first. According to the agreed format, the first two letters of each instruction are "AT", which is defined in the at_wifi_items structure array in the atcmd_wifi.c file
.

"ATxx" is the instruction identification character, "fATxx" is the instruction execution function, user-defined instructions need to add the instruction identification character and implement the instruction execution function by themselves

2. Receipt and Execution of Instructions

The receiving and data packaging of AT commands are executed in the serial port interrupt function uart_irq, and the interrupt function is in the example_uart_atcmd.c file. The interrupt function mainly packs the data received by the serial port, and ends with a carriage return and line feed. After receiving an instruction, the instruction processing thread is notified to parse and process the instruction by sending the signal rtw_up_sema_from_isr(&log_rx_interrupt_sema). Instruction parsing and execution functions are performed in the log_service function. The service function waits for the serial port to receive the interrupt function to send the log_rx_interrupt_sema signal. After receiving the signal, call log_handler to match the corresponding instruction from the instruction list. After matching the instruction, call the corresponding instruction processing function to achieve the relevant function.

Guess you like

Origin blog.csdn.net/qq_44078824/article/details/119866322