Welcome to MSPM0G3507 Development Board repository
9.k230 human body detection
k230 human body detection
k230 human body detectionk230 and MSPM0 communication1. Experimental Prerequisites2. Experimental wiring3. Main code explanation4. Experimental Phenomenon
k230 and MSPM0 communication
1. Experimental Prerequisites
This tutorial uses the MSPMG3507 development board, and the corresponding routine path is [14.export\MSPM0-K230\09_k230_person_detect].
K230 needs to run the [14.export\CanmvIDE-K230\09.person_detection.py] program to start the experiment. It is recommended to download it as an offline program.
Things you need:
Windows computer MSPMG3507 development board K230 visual module (including TF card with image burned in) Two type-C data cables Connection cable
2. Experimental wiring
| k230 vision module | MSPM0 Development Board |
|---|---|
| 5V | VCC |
| GND | GND |
| TXD(IO9) | A22 |
| RXD(IO10) | A21 |

3. Main code explanation
xvoid Pto_Data_Parse(uint8_t *data_buf, uint8_t num){ uint8_t pto_head = data_buf[0]; uint8_t pto_tail = data_buf[num-1]; if (!(pto_head == PTO_HEAD && pto_tail == PTO_TAIL)) { sprintf(print_buf, "pto error:pto_head=0x%02x , pto_tail=0x%02x\n", pto_head, pto_tail); uart0_send_string(print_buf); return; } uint8_t data_index = 1; uint8_t field_index[PTO_BUF_LEN_MAX] = {0}; int i = 0; int values[PTO_BUF_LEN_MAX] = {0}; for (i = 1; i < num-1; i++) { if (data_buf[i] == ',') { data_buf[i] = 0; field_index[data_index] = i; data_index++; } } for (i = 0; i < data_index; i++) { values[i] = Pto_Char_To_Int((char*)data_buf+field_index[i]+1); } uint8_t pto_len = values[0]; if (pto_len != num) { sprintf(print_buf, "pto_len error:%d , data_len:%d\n", pto_len, num); uart0_send_string(print_buf); return; } uint8_t pto_id = values[1]; if (pto_id != PTO_FUNC_ID) { sprintf(print_buf, "pto_id error:%d, func_id:%d\n", pto_id, PTO_FUNC_ID); uart0_send_string(