1. Unboxing Contents:
- AiPi-R2 development board ×1
- Camera module: Coovision CV031C50 ×1
- 4-inch touch display: Uye UE040WV ×1
- 65dB microphone ×1
- 8Ω2W speakers ×2
- Connection cables ×2
Issue: Internal packaging is very detailed, but the outer carton is too soft, risking hardware damage.
2. Environment Setup
Using VScode for compilation. Refer to: “Beginner Guide: Setting up AiPi-R2 Windows Environment” on Ai-Thinker Forum.
Encountered issue during compilation:
Fix: Open aithinker_Ai-M6X_SDK\project.build, comment out lines 75 and 76 by adding # at the beginning and save.
# cp $(BL_SDK_BASE)/bsp/board/bl616dk/config/edata.bin build/build_out
# cp $(BL_SDK_BASE)/bsp/board/bl616dk/config/Rx_boot2_m61.bin build/build_out
3. Example Testing
No onboard LED (recommended to add one), making it hard to verify board operation without a display.
LVGL Demo: Reflashed official LVGL example using make for compilation and make flash COMX=COM3 for flashing (COM3 is USB-TTL port).
Re-burn the LVGL official routines. Use make to compile the code and make flash COMX=COM3 to burn it. COM3 is the port currently connected to the development board. Use USB to TTL. The connection diagram is as follows:
4. LVGL Integration & Testing
LVGL was customized based on the AiPi-Eyes-Rx example. After GUI design using GuiGuider, generate and replace the generated folder under demos\ai_lvgl\src\generated.
5. SPI TF Card Reading & FATFS Filesystem
Wired the onboard SPI to a TF card module (or solder a TF slot). Adjust pin definitions accordingly.
Key SPI code: Refer to
aithinker_Ai-M6X_SDK\examples\peripherals\spi\spi_poll,SPI configuration and TF card initialization code included in the document.
void spi_isr(int irq, void *arg)
{
uint32_t intstatus = bflb_spi_get_intstatus(spi0);
if (intstatus & SPI_INTSTS_TC) {
bflb_spi_int_clear(spi0, SPI_INTCLR_TC);
//printf("tc done\r\n");
spi_tc_done_count++;
}
if (intstatus & SPI_INTSTS_TX_FIFO) {
//printf("tx fifo\r\n");
}
if (intstatus & SPI_INTSTS_RX_FIFO) {
//printf("rx fifo\r\n");
}
}
void SPI_init(u32 freqm)
{
struct bflb_spi_config_s spi_cfg =
{
#if (SPI_CASE_SELECT == SPI_MASTER_CASE)
.freq = freqm,
.role = SPI_ROLE_MASTER,
#else
.freq = 32 * 1000 * 1000,
.role = SPI_ROLE_SLAVE,
#endif
.mode = SPI_MODE3,
.data_width = SPI_DATA_WIDTH_8BIT,
.bit_order = SPI_BIT_MSB,
.byte_order = SPI_BYTE_LSB,
.tx_fifo_threshold = 0,
.rx_fifo_threshold = 0,
};
spi0 = bflb_device_get_by_name("spi0");
bflb_spi_init(spi0, &spi_cfg);
bflb_spi_tcint_mask(spi0, false);
bflb_irq_attach(spi0->irq_num, spi_isr, NULL);
bflb_irq_enable(spi0->irq_num);
bflb_spi_feature_control(spi0, SPI_CMD_SET_CS_INTERVAL, 0);
}// Modify board.h and add the following:
void board_spi0_gpio_init()
{
struct bflb_device_s* gpio;
gpio = bflb_device_get_by_name("gpio");
// spi cs
bflb_gpio_init(gpio,...
Read more »
Ai-Thinker
agp.cooper
Sagar 001