This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AWR2944EVM: 传感器论坛

Part Number: AWR2944EVM


你好,工程师

        我想使用uart向自己写的上位机发送点云数据,使用的是开发板已经完成初始化的用于mmwave visualizer的串口,我在函数MmwDemo_transmitProcessedOutput中使用malloc开辟内存,将它作为trans.buf,但是发现当申请的内存大于4KB时,板子就会宕机。在data sheet上看到在MCU这边应该有960KB的L2 RAM,应该不会内存不够。我在只进行malloc和free测试时,申请的内存超过4KB,也会宕机,请问是什么原因导致的?现在每个point使用100B的空间,如果使用malloc申请内存受限,可以发出的点很少,请问在MCU这边有专门的申请内存的函数吗?

uint32_t uart_read_count = result->numObjOut;
    CLI_write("%d point has detected in this frame\r\n",uart_read_count);
    uint32_t uart_cnt=0;
    DPIF_PointCloudCartesian *uart_obj = result->objOut;
    char *myuart_buf = (char*)malloc(sizeof(char)*20*5*uart_read_count);  //一个数据的长度为10+1个空格,一个point共5个数据,共result->numObjOut个点
    memset(myuart_buf,0,sizeof(char)*20*5*uart_read_count);
    while(uart_cnt<uart_read_count)
    {
        char temp[5][20];
        sprintf(temp[0],"%-18.6f ",uart_obj->energy);
        memcpy(myuart_buf+60*uart_cnt,temp,sizeof(char)*20);
        sprintf(temp[1],"%-18.6f ",uart_obj->range);
        memcpy(myuart_buf+60*uart_cnt+20,temp[1],sizeof(char)*20);
        sprintf(temp[2],"%-18.6f ",uart_obj->velocity);
        memcpy(myuart_buf+60*uart_cnt+40,temp[2],sizeof(char)*20);
        sprintf(temp[3],"%-18.6f ",uart_obj->azimuth);
        memcpy(myuart_buf+60*uart_cnt+60,temp[3],sizeof(char)*20);
        sprintf(temp[4],"%-18.6f ",uart_obj->elevation);
        memcpy(myuart_buf+60*uart_cnt+80,temp[4],sizeof(char)*20);
        uart_obj++;
        uart_cnt++;
    }
    CLI_write("uart packet have been packeted\r\n");
    UART_Transaction_init(&trans);
    trans.buf   = (uint8_t*)myuart_buf;
    trans.count = sizeof(char)*100*uart_read_count;
    UART_write(uartHandle, &trans);
    free(myuart_buf);

                                                                                                                                                                                                                    谢谢