51uwb.cn

标题: 使用官方轮询发送,接收Demo,轮询发送正常,轮询接收不到消息,是什么原因? [打印本页]

作者: iuni3309    时间: 2024-2-2 11:03
标题: 使用官方轮询发送,接收Demo,轮询发送正常,轮询接收不到消息,是什么原因?
/**
* Application entry point.
*/
void simple_rx_example(void)
{

    /* Loop forever receiving frames. */
    while (1)
    {
        int i;

        /* TESTING BREAKPOINT LOCATION #1 */
        LED0_TOGGLE();
        /* Clear local RX buffer to avoid having leftovers from previous receptions  This is not necessary but is included here to aid reading
         * the RX buffer.
         * This is a good place to put a breakpoint. Here (after first time through the loop) the local status register will be set for last event
         * and if a good receive has happened the data buffer will have the data in it, and frame_len will be set to the length of the RX frame. */
        for (i = 0 ; i < FRAME_LEN_MAX; i++ )
        {
            rx_buffer = 0;
        }

        /* Activate reception immediately. See NOTE 3 below. */
        dwt_rxenable(DWT_START_RX_IMMEDIATE);

        /* Poll until a frame is properly received or an error/timeout occurs. See NOTE 4 below.
         * STATUS register is 5 bytes long but, as the event we are looking at is in the first byte of the register, we can use this simplest API
         * function to access it. */
        while (!((status_reg = dwt_read32bitreg(SYS_STATUS_ID)) & (SYS_STATUS_RXFCG | SYS_STATUS_ALL_RX_ERR)))
        {
                                                printf("status_reg:%x",status_reg);
                                          delay_ms(200);
                                };

        if (status_reg & SYS_STATUS_RXFCG)
        {
            /* A frame has been received, copy it to our local buffer. */
            frame_len = dwt_read32bitreg(RX_FINFO_ID) & RX_FINFO_RXFL_MASK_1023;
            if (frame_len <= FRAME_LEN_MAX)
            {
                dwt_readrxdata(rx_buffer, frame_len, 0);
                                                       
                                                                printf("Recv frame,frame_len is %d,frame data:\r\n",frame_len);
                                                       
                                                                for(i=0; i<frame_len; i++){                                                       
                                                                        printf("%02x",rx_buffer);
                                                                }
                                                               
                                                                printf("\r\n");
            }

            /* Clear good RX frame event in the DW1000 status register. */
            dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_RXFCG);
        }
        else
        {
            /* Clear RX error events in the DW1000 status register. */
            dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR);
        }
    }
}



并且打印状态 一直返回 0x0x00800002,求大神解疑


作者: 蓝点无限    时间: 2024-2-2 12:37
不建议使用官方代码,臃肿晦涩难懂,调试复杂。
可以使用我们的代码框架调试
http://51uwb.cn/forum.php?mod=vi ... &extra=page%3D1
作者: xgxg    时间: 3 天前
想问楼主您问题解决了吗




欢迎光临 51uwb.cn (http://51uwb.cn/) Powered by Discuz! X3.3