51uwb.cn

 找回密码
 立即注册
查看: 179|回复: 1
打印 上一主题 下一主题

使用官方轮询发送,接收Demo,轮询发送正常,轮询接收不到消息,是什么原因?

[复制链接]

1

主题

2

帖子

6

积分

新手上路

Rank: 1

积分
6
跳转到指定楼层
楼主
发表于 2024-2-2 11:03:25 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/**
* 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,求大神解疑

回复

使用道具 举报

35

主题

965

帖子

4052

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4052
沙发
发表于 2024-2-2 12:37:55 | 只看该作者
不建议使用官方代码,臃肿晦涩难懂,调试复杂。
可以使用我们的代码框架调试
http://51uwb.cn/forum.php?mod=vi ... &extra=page%3D1
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

bphero Inc.  

GMT+8, 2024-5-2 15:44 , Processed in 0.011139 second(s), 4 queries , File On.

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc. Template By 【未来科技】【 www.wekei.cn 】

快速回复 返回顶部 返回列表