This tutorial uses the MSPM0G3507 development board. K210 needs to run the program in K210-AI(MSPM0G3507) to start the experiment
MSPM0G *1
K210 visual module *1 (sd card (with AI model), camera)
USB to TTL module *1
Method 1: Use USB to TTL module
| MSPM0G | K210 visual module |
|---|---|
| RX | TXD |
| GND | GND |
| VCC | 5V |
| MSPM0G | USB to TTL module |
|---|---|
| TX | RXD |
| GND | GND |

Method 2: Use the onboard Type-C port

This example sets the baud rate of the serial port printing to 115200 bps, and the baud rate of the k210 module connection is set to 115200 bps.


xxxxxxxxxxint main(void){ SYSCFG_DL_init(); NVIC_ClearPendingIRQ(MYUART_INST_INT_IRQN);//清除串口中断标志 Clear the serial port interrupt flag NVIC_EnableIRQ(MYUART_INST_INT_IRQN);//使能串口中断 Enable serial port interrupt while (1) { if (k210_msg.class_n != 0)//例程号不为空 Routine number is not empty { if(k210_msg.class_n == 10)//是自主学习分类 Self-learning classification { sprintf(buff_com,"id = %c\r\n",k210_msg.id); uart0_send_string(buff_com); k210_msg.class_n = 0;//清除例程号 Clear Routine Number } } delay_ms(500); }} After the above program, if this routine is run, the members of the k210_msg structure will have corresponding values and will be processed through the serial port printing
k210_msg: is the structure for receiving information, and its main members are
After the data is received and processed by the function, each member of k210_msg will store valid information. If you want to perform secondary development, you can directly call the members of k210_msg
Note: The keil project source code must be compiled under the SDK path.
Link:http://www.yahboom.net/study/K210-Al-Camera
Set the serial port assistant to the interface shown in the figure
Then run the self-learning classification routine, and the serial port assistant will print out the important information transmitted by k210 to MSPM0G, as shown in the figure below
Object detection only transmits one member variable of k210_msg id.
id: refers to the object id when taking a photo, the range of id is (1-3)