完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我用和声来配置可以收听所有消息。我知道我的设备有3个不同的消息地址;但是,我无法检索任何更高的寻址消息。从CANBUS分析器,我收到以下地址:DATA0x0CEEFD2:3200 000 000 000 000 0x10FFAAD2:184300 10Ccc9009000X10FFA9D2:000 0301AA0B00 00这是很漂亮的T。典型的,现在和谐。我一直在听所有的信息,因为我不知道为什么我看到一个问题。和声结构如下。没关系,我不能附加一个屏幕截图,但是基本上MAX和过滤器是0x0,我在听所有的东西。在上面的例子中,我只看到来自0x0CEFED2的消息,我认为这是因为它是最低的地址。如果我将过滤器改为0x10FFAAD2和我的掩码到0x1FFFFFF,我想我会看到来自频道1的设备0x10FFAAD2的消息。我看到的不是消息。事实上,如果我将过滤器设置为BEXX100000,并且掩码为0x100000,我仍然看不到更高的地址消息,即使我通过分析器看到总线上的数据。我的中断例程如下:在上面的代码中,UsARTARI命令只是我用来通过USAT获取数据的实用工具。正如你所看到的,我基本上进入了数据结构,因为我无法弄清楚为什么我没有通过抽象函数看到数据。我对CANBUS屏蔽/过滤器设置有什么基本的缺陷吗?(我使用PIC32 MZ)任何指导都将不胜感激。
以上来自于百度翻译 以下为原文 I am using HARMony to configure CAN to listen to all messages. I know that my device has 3 different message addresses; however, I've been unable to retrieve any of the higher addressed messages. From the CANBUS analyzer, I receive the following: ADDRESS : DATA 0x0CEEFFD2 : 3200000000000000 0x10FFAAD2 : 18430010CC090000 0x10FFA9D2 : 000301AA0B000000 These are pretty typical, and now to Harmony. I've been listening to all messages because I have no idea of why I am seeing an issue. The Harmony configuration is as follows. In the case above, I see only the message from 0x0CEEFFD2, and I assume that's because it's the lowest address. If I change my filter to: 0x10FFAAD2 and my mask to 0x1FFFFFFF, I thought that I would see the message from device 0x10FFAAD2 on channel 1. What I see is no messages. In fact, if I set the filter to be 0x10000000, and the mask to be 0x1000000, I still see none of the higher address messages, even though I see the data on the bus via the analyzer. My interrupt routine is as follows. void __ISR(_CAN1_VECTOR, IPL3AUTO) _IntHandlerDrvCANInstance0(void) { char stringa[64]; CAN_RX_MSG_BUFFER *RxMessage; unsigned int tempAddress = 0; unsigned int r_event = PLIB_CAN_ModuleEventGet(CAN_ID_1); switch (r_event) { case CAN_RX_EVENT: RxMessage = (CAN_RX_MSG_BUFFER *) PLIB_CAN_ReceivedMessageGet(CAN_ID_1, 1); if (RxMessage != NULL) { if (RxMessage->msgEID.ide) //EID Address { tempAddress = (RxMessage->msgSID.sid << 18); tempAddress |= ((0x3FFFF)&(RxMessage->msgEID.eid)); } else { tempAddress = RxMessage->msgSID.sid; } sprintf(stringa, "0x%x", tempAddress); WRT_USART_WriteLine(appData.handleUSART6, stringa, strlen(stringa)); WRT_USART_WriteBinArray(appData.handleUSART6,RxMessage->data,RxMessage->msgEID.data_length_code); } else { WRT_USART_WriteLine(appData.handleUSART6, "null", strlen("null")); } PLIB_CAN_ChannelUpdate(CAN_ID_1, 1); break; } PLIB_CAN_ModuleEventClear(CAN_ID_1, r_event); PLIB_INT_SourceFlagClear(INT_ID_0, INT_SOURCE_CAN_1); } In the code above, the USART_ commands are just utilities that I use to get the data out via USART. As you can see, I basically went into the data structures because I was unable to sort out why I wasn't seeing data through the abstracted functions. Any suggestions on how to get the messages with the higher address? Do I have a some fundamental flaw in my understanding of the CANBUS mask/filter settings? (I'm using a PIC32MZ) Any guidance would be greatly appreciated. |
|
相关推荐
6个回答
|
|
你使用的是什么版本的和声(1?x或2?x)?
以上来自于百度翻译 以下为原文 Which version of Harmony are you using (1.x or 2.x)? |
|
|
|
|
|
|
|
两个观察(可能或可能不重要):应该:PLBIK-Chan-ChhannUp更新(ChanaId1,1);在开关/ case语句之外移动?而不是ReEngEnter(仅仅是一个编程的优点)的无符号int:Chan-MeaveEnEncInEngult= PLIPK-CuiMeaveEngIGET(ChanaId1);
以上来自于百度翻译 以下为原文 a couple of observations (may or may not matter): Should the: PLIB_CAN_ChannelUpdate(CAN_ID_1, 1); be moved outside of the switch/case statement? instead of unsigned int for r_event (just a programming goodness): CAN_MODULE_EVENT r_event = PLIB_CAN_ModuleEventGet(CAN_ID_1); |
|
|
|
我一直在玩这个,但没有效果。当生成事件时,它才生成。这就是为什么在处理事件之前我不检查ID的原因。我相信这是真的,因为第4452页的图片在OrthyYelHelp.PDF版本2.02V上回到了问题的症结,如果我只使用0x0作为掩码和过滤器,我会得到最低优先级的消息。我要找的是Mease0x10FFAAD2,所以我将过滤器设置为这个值。我把面具设为0x1FFF000,因为我想确定我没有在某个地方漏掉一些地址。对于这些设置,我从CAN中断中看不到任何东西。我想我会开始关注PLIB,但是为PLIB生成的和谐代码看起来很好:我知道的事情是:1)它是连接的,因为我可以通过0x0过滤器看到总线上的最低优先级消息。2)如果我把面罩/过滤器换成总线上的其他地址,它就不起作用了。我觉得这是一个平凡的细节,但我不知道会是什么。这种模式和它有什么关系吗?我只是在听留言,非常感谢您的建议。
以上来自于百度翻译 以下为原文 I've been playing around with this, but to no avail. When an event is generated, it's just generated. This is why I do not check for the ID until I handle the event. I believe this is true due to the image on page 4452 on version 2.02v of the harmony_help.pdf Back to the crux of the issue, if I just use 0x0 for the mask and filter, I get the lowest priority message. What I am looking for is message 0x10FFAAD2, so I set the filter to this value. I set the mask to 0x1FFFF000 because I wanted to be sure that I wasn't missing some address somewhere. For these settings, I see nothing from the CAN interrupt. I figured that I'd start to look at PLIB, but the Harmony code generated for PLIB looks pretty good: void DRV_CAN0_Initialize(void) { /* Switch the CAN module ON */ PLIB_CAN_Enable(CAN_ID_1); /* Switch the CAN module to Configuration mode. Wait until the switch is complete */ PLIB_CAN_OperationModeSelect(CAN_ID_1, CAN_CONFIGURATION_MODE); while(PLIB_CAN_OperationModeGet(CAN_ID_1) != CAN_CONFIGURATION_MODE); PLIB_CAN_PhaseSegment2LengthFreelyProgrammableEnable(CAN_ID_1); //Set the Baud rate to 250 kbps PLIB_CAN_PropagationTimeSegmentSet(CAN_ID_1, 1-1); PLIB_CAN_PhaseSegment1LengthSet(CAN_ID_1, 3-1); PLIB_CAN_PhaseSegment2LengthSet(CAN_ID_1, 3-1); PLIB_CAN_SyncJumpWidthSet(CAN_ID_1, 1-1); PLIB_CAN_BaudRatePrescaleSet(CAN_ID_1, 49); // set to 1 higher then ECAN tool /* Assign the buffer area to the CAN module. In this case assign enough memory for 2 channels, each with 8 message buffers.*/ PLIB_CAN_MemoryBufferAssign(CAN_ID_1, can_message_buffer0); /* Configure CAN_ID_1 Channel for CAN_TX_RTR_DISABLED operation. Allocate 1 message buffer, and assign low medium priority for transmissions. */ PLIB_CAN_ChannelForTransmitSet(CAN_ID_1, CAN_CHANNEL0, 1, CAN_TX_RTR_DISABLED, CAN_LOW_MEDIUM_PRIORITY); /* Configure CAN_ID_1 Channel for CAN_RX_FULL_RECEIVE operation. Allocate 1 message buffer, and assign low medium priority for transmissions. */ PLIB_CAN_ChannelForReceiveSet(CAN_ID_1, CAN_CHANNEL1, 1, CAN_RX_FULL_RECEIVE); PLIB_CAN_FilterToChannelLink(CAN_ID_1, CAN_FILTER0, CAN_FILTER_MASK0, CAN_CHANNEL1); PLIB_CAN_ChannelEventEnable(CAN_ID_1, CAN_CHANNEL1, CAN_RX_CHANNEL_NOT_EMPTY); PLIB_CAN_FilterConfigure(CAN_ID_1, CAN_FILTER0, 0x10FFAAD2, CAN_EID); PLIB_CAN_FilterEnable(CAN_ID_1, CAN_FILTER0); PLIB_CAN_FilterMaskConfigure(CAN_ID_1, CAN_FILTER_MASK0, 0x1FFFF000, CAN_EID, CAN_FILTER_MASK_ANY_TYPE); /* Switch the CAN module to Normal mode. Wait until the switch is complete */ PLIB_CAN_OperationModeSelect(CAN_ID_1, CAN_LISTEN_ALL_MESSAGES_MODE); while(PLIB_CAN_OperationModeGet(CAN_ID_1) != CAN_LISTEN_ALL_MESSAGES_MODE); PLIB_CAN_ModuleEventEnable(CAN_ID_1 , 0|CAN_All_EVENTS); /* Setup CAN_ID_1 Interrupt */ PLIB_INT_SourceEnable(INT_ID_0,INT_SOURCE_CAN_1); PLIB_INT_VectorPrioritySet(INT_ID_0,INT_VECTOR_CAN1, INT_PRIORITY_LEVEL3); PLIB_INT_VectorSubPrioritySet(INT_ID_0,INT_VECTOR_CAN1, INT_SUBPRIORITY_LEVEL1); } The things that I know: 1) it's connected, as I can see the lowest priority message on the bus via the 0x0 filter. 2) I'm if I change the mask/filter to the other addresses on the bus, it doesn't work. I feel that this is a mundane detail in the configuration, but I have no idea what that would be. Would the mode have something to do with it? I'm just listening to messages. Any suggestions would be greatly appreciated. |
|
|
|
在愚蠢的世界里,我删除了所有自动生成的和声文件,并从描述中重建一切。它神奇地开始工作。耸耸肩:我把这个粉刷成一个未知的和声错误。我会更仔细地看看是否能复制它。
以上来自于百度翻译 以下为原文 In the world of silliness, I deleted all of the auto generated Harmony files and rebuilt everything from the description. It magically started working. |
|
|
|
嘿,伙计们!我也有同样的问题。我重建了代码,但仍然不起作用。你应该帮助我吗?
以上来自于百度翻译 以下为原文 Hey guys! I'm having the same problem too. I rebuilt the code but still don't working. You should help me? |
|
|
|
只有小组成员才能发言,加入小组>>
5243 浏览 9 评论
2035 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3208 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2258 浏览 5 评论
779浏览 1评论
672浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
598浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
680浏览 0评论
578浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 13:45 , Processed in 1.893463 second(s), Total 86, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号