Hi Team,
I am working on a custom-built board (ESP32 & mmWave Sensor IWR6843). we're chosen ESP2_U2_Tx /Rx pins are connected to SMD RS232_Tx / Rx. over-on tap of SMD connector we put a mmWave sensor. my question here is, I want to send a configuration file to mmWave using ESP_U2_Tx / Rx and check the output using ESP_DEBUG_TX /Rx pins. I have checked the people count visualizer and MatLab code. but how to identified control port and data ports in the visualizer. how to recognizing this is a control port and this is the data port. how I can send commands over TTL to UART converter. please do the needful.
Here I am attached my c code. Please do the needful. please send me schematics and pin diagram of IWR6843.
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_system.h" #include "nvs_flash.h" #include "driver/uart.h" #include "freertos/queue.h" #include "esp_log.h" #include "soc/uart_struct.h" #include <unistd.h> #include <signal.h> #include <termios.h> #include <fcntl.h> #include <string.h> #include <pthread.h> #include <time.h> #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define ECHO_TEST_TXD (17) #define ECHO_TEST_RXD (16) #define BUF_SIZE (1024) int i=0; //int portfd_ZB; //an example of echo test with hardware flow control on UART1 static void echo_task() { const int uart_num0 = UART_NUM_0; uart_config_t uart_config0 = { .baud_rate = 115200, .data_bits = UART_DATA_8_BITS, .parity = UART_PARITY_DISABLE, .stop_bits = UART_STOP_BITS_1, .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, //UART_HW_FLOWCTRL_CTS_RTS, .rx_flow_ctrl_thresh = 122, }; const int uart_num2 = UART_NUM_2; uart_config_t uart_config1 = { .baud_rate = 115200, .data_bits = UART_DATA_8_BITS, .parity = UART_PARITY_DISABLE, .stop_bits = UART_STOP_BITS_1, .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, //UART_HW_FLOWCTRL_CTS_RTS, .rx_flow_ctrl_thresh = 122, }; //Configure UART1 parameters uart_param_config(uart_num0, &uart_config0); uart_param_config(uart_num2, &uart_config1); uart_set_pin(uart_num0, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); uart_set_pin(uart_num2, ECHO_TEST_TXD, ECHO_TEST_RXD, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); //Install UART driver (we don't need an event queue here) //In this example we don't even use a buffer for sending data. uart_driver_install(uart_num0, BUF_SIZE * 2, 0, 0, NULL, 0); uart_driver_install(uart_num2, BUF_SIZE * 2, 0, 0, NULL, 0); uint8_t* data = (uint8_t*) malloc(BUF_SIZE); char config6843[24][64]={//"sensorStop\n", /*"flushCfg\n", "dfeDataOutputMode 1\n", "channelCfg 15 5 0\n", "adcCfg 2 1\n", "profileCfg 0 60.6 30 10 62 0 0 53 1 128 2500 0 0 30\n", "chirpCfg 0 0 0 0 0 0 0 1\n", "chirpCfg 1 1 0 0 0 0 0 4\n", "frameCfg 0 1 128 0 50 1 0\n", "lowPower 0 0\n", "guiMonitor 1 1 0 0\n", "cfarCfg 6 4 4 4 4 16 16 4 4 55 67 0\n", "doaCfg 600 1875 30 1 1 0\n", "SceneryParam -6 6 0.5 6\n", "GatingParam 3 2 2 0\n", "StateParam 10 5 100 100 5\n", "AllocationParam 250 250 0.25 30 1 2\n", "trackingCfg 1 2 250 20 52 82 50 90",*/ "sensorStart\n" } ; /*if((portfd_ZB = uart_num2)<0){ printf("%s: %s (%d)zigbee open port failed,portfd_ZB=%d\n",__FILE__,__func__,__LINE__,portfd_ZB); } else*/ for(i=0;i<24;i++){ uart_write_bytes(uart_num2, (const char*)config6843[i], sizeof(config6843[i])); usleep(1000); } // char* test_str = "This is a test string.\n"; //uart_write_bytes(uart_num2, (const char*)config6843[i], sizeof(config6843[i])); // usleep(1000); while(1) { //char* test_str = "This is a test string.\n"; //uart_write_bytes(uart_num2, (const char*)test_str, strlen(test_str)); //usleep(1000); // Read data from UART. int length = uart_read_bytes(uart_num2, data, BUF_SIZE, 200); printf("Received Data %.2x\n", length); for(int i=0;i < length; i++){ printf("%.2x ", data[i]); } esp_err_t uart_flush(uart_port_t uart_num2); } } void app_main() { //A uart read/write example without event queue; xTaskCreate(echo_task, "uart_echo_task", 1024, NULL, 10, NULL); }