CAN Bus Communication
Hi,
Any Can bus example code for BF706? I want to receive a file from a customer software through CAN bus. I assume that the file data has to be saved into mail box, but my file has 111312 arrays. How can I save all arrays into mailbox?
Thanks
dsp
cross core
bf706
blackfin
Hi,
Can you please have a look at the example available in the ADSP-BF707 Board support package(BSP) to check the DSP. Please download and install the board support package for ADSP-BF707 in the below link.
www.analog.com/.../eval-bf707.html
Once you installed, you can find the example code in the below path.
[Installation directory]:\Analog Devices\ADSP-BF707_EZ-Board-Rel1.0.1\BF707_EZ-Board\Blackfin\Examples\Power_On_Self_Test
You can refer to the ADSP-BF707 CAN example codes from above path.
Hope this helps.
Regards,
Anand Selvaraj.
Thank you Anand,
I am able to Send and Receive data to/from my customer software, through CAN bus. But I have some issue regarding timing, buffering the data received from software interface.
As I understand every time I receive data, then I clear my mailbox register by *pREG_CAN1_MC1 = 0; and then the mailbox is ready to get next data. Something like follow:
if((*pREG_CAN1_MBRIF1 & (1<<2)))
{
Data_Zero_test[i+1+j] = *pREG_CAN1_MB02_DATA3 & 0xFF;
Data_Zero_test[i+j] = *pREG_CAN1_MB02_DATA3 >> 8;
....
*pREG_CAN1_MC1 = 0;
}
Hi,
The CAN hardware autonomously receives messages and discards invalid messages. Once a valid message is successfully received, the receive logic interrogates all enabled receive mailboxes. The logic interrogates sequentially, from mailbox 23 down to mailbox 0, whether the message is of interest to the local node or not.
Each incoming data frame is compared to all identifiers stored in the active receive and transmit mailboxes with the
feature for remote frame handling enabled (=1). (The active receive mailboxes indices of CAN_MD1(mailbox direction receive/transmit) and CAN_MC1(mailbox configuration enable/disable) registers are set to 1.) The message identifier of the received message, along with the identifier extension(CAN_MB[nn]_ID1.IDE) and remote transmission request (CAN_M[nn]_ID1.RTR) bits, are compared with the register settings of each mailbox. In standard mode, the message is compared with the content of the CAN_MB[nn]_ID1 register. In extended mode, the content of the CAN_MB[nn]_ID0 register must also match.
If the acceptance filter finds a matching identifier, the content of the received data frame is stored in that mailbox. A received message is stored only once, even if multiple receive mailboxes match its identifier. If the current identifier does not match any mailbox, the message is not stored.
If a message is received for a mailbox and that mailbox still contains unread data (CAN_RMP1.MB), then the program decides whether to overwrite the old message. If the CAN_OPSS1.MB bit is cleared, the corresponding CAN_RML1.MB bit is set, and the stored message is overwritten. The receive message lost interrupt occurs(CAN_GIS.RMLIS is set). If, however, the CAN_OPSS1.MB bit is set, the next mailboxes are checked for another matching identifier. If no match is found, the message is discarded, and the next message is checked.
NOTE: If a receive mailbox is disabled, an ongoing receive message for that mailbox is lost even if a second mailbox is configured to receive the same identifier.
Regards,
Anand Selvaraj.
Please log in to reply.