stm_ K210 object detection1. Communication between k210 and stm321.1 Experimental premises1.2 Experimental wiring1.3 Main code explanation1.4 experimental phenomena
This tutorial uses stm32C8T6, and k210 requires running the program in K210-AI (stm32_pico_arduino) to start the experiment Stm32 * 1 K210 perspective module * 1 (requires SD card (with AI model inside) and camera) USB to TTL module * 1
stm32 | usb to ttl |
---|---|
PA2 | RXD |
GND | GND |
STM32 | k210 |
---|---|
PA3 | TXD |
GND | GND |
VCC | 5V |
Wiring as shown in the diagram:
This type of wiring is not necessary for the RXD of k210 and the TXD of USB to TTL, as it was not used in the experiment.
xint main()
{
//......
while(1)
{
if (k210_msg.class_n != 0)
{
if(k210_msg.class_n == 9)
{
sprintf(buff_com,"x=%d,y=%d,w=%d,h=%d\r\n",k210_msg.x,k210_msg.y,k210_msg.w,k210_msg.h);
USART2_Send_ArrayU8((uint8_t*)buff_com,strlen(buff_com));
sprintf(buff_com,"id = %s\r\n",k210_msg.msg_msg);
USART2_Send_ArrayU8((uint8_t*)buff_com,strlen(buff_com));
k210_msg.class_n = 0;
}
}
}
}
After the above program, if you are running this routine, k210_ The members of the msg structure have corresponding values and are processed through serial port printing K210_ Msg: is a structure that receives information, and its main members are
Object detection only transmits k210_ The six Member variable of msg are x, y, w, h, id and msg. ID: The information includes (0. plane, 1. bicycle, 2. bird, 3. boat, 4. bottle, 5. bus, 6. car, 7. cat, 8. chair, 9. cow, 10. dining table, 11. dog, 12. horse, 13. motorcycle, 14. person, 15. potted plant, 16. sheep, 17. sofa, 18. train, 19. monitor)