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 (must have an SD card (with AI models), 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.
xxxxxxxxxx
int 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 == 11)//是手写数字识别 Handwritten digit recognition
{
sprintf(buff_com,"class = %d,x=%d,y=%d,w=%d,h=%d\r\n",k210_msg.class_n,k210_msg.x,k210_msg.y,k210_msg.w,k210_msg.h);
uart0_send_string(buff_com);
k210_msg.class_n = 0;
}
}
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
Handwritten digit recognition only transmits one member variable of k210_msg, id.
id: refers to the recognized digital ID (0-9)