/* Transmit a CAN message from the specified mailbox */
void can_ringo_tx(CANDEV_RINGO *dev, canmsg_t *txmsg)
{
//fprintf(stderr,"into can_ringo_tx:CANESR = 0x%02x\n",in32(dev->devinfo->base + RINGO_CANESR));
//fprintf(stderr,"***1***\n");
//can_ringo_debug(dev);
//fprintf(stderr,"***2***\n");
CANDEV_RINGO_INFO *devinfo = dev->devinfo;
int mbxid = dev->mbxid;
// Access the data as a uint32_t array
uint32_t *val32 = (uint32_t *)txmsg->cmsg.dat;
/* test by dyb */
volatile uint32_t i;
/*
* IDLE - Idle Status. The IDLE bit indicates, when there is activity
* on the CAN bus
* 1 - The CAN bus is Idle
*
* TX/RX - Transmission/receive status.
* Indicates when the FlexCAN module is transmitting or receiving a message.
* TX/RX has no meaning, when IDLE = 1
* 0 - FlexCAN is receiving when IDLE = 0
* 1 - FlexCAN is transmitting when IDLE = 0
*/
// Wait till bus available
//delay(2000);
//fprintf(stderr,"***3***\n");
#if 0
while((in32(devinfo->base + RINGO_CANESR) & RINGO_CANES_IDLE) == 0);
#endif
#if 1
for (i=0; i<999999;i++)
{
canesr_val = in32(devinfo->base + RINGO_CANESR) & RINGO_CANES_IDLE;
if (canesr_val != 0)
{
break;
}
}
#endif
//fprintf(stderr,"***4***\n");
// Trasmission inactive
devinfo->canmsg[mbxid].canmcf |= ((TRANS_CODE_NOT_READY & 0x0F) << 24);
// Copy message data into transmit mailbox
devinfo->canmsg[mbxid].canmdl = val32[0];
devinfo->canmsg[mbxid].canmdh = val32[1];
if(devinfo->iflags & INFO_FLAGS_ENDIAN_SWAP)
{
// Convert from Little Endian to Big Endian since data is transmitted MSB
ENDIAN_SWAP32(&devinfo->canmsg[mbxid].canmdl);
ENDIAN_SWAP32(&devinfo->canmsg[mbxid].canmdh);
}
/*解决发送CAN ID 不变问题*/
devinfo->canmsg[mbxid].canmid = (txmsg->cmsg.mid & RINGO_CANMID_MASK_EXT) | RINGO_CANMC_FEN;
// Trasmission active 配置添加发送数据len
// devinfo->canmsg[mbxid].canmcf &=0xfff0ffff;
devinfo->canmsg[mbxid].canmcf &=0xffE0ffff;
devinfo->canmsg[mbxid].canmcf |= ((TRANS_CODE_TRANSMIT_ONCE & 0x0F) << 24) | (txmsg->cmsg.len << 16);
//fprintf(stderr,"***6***\n");
}
Hi
The imx6Q I use is equipped with QNX system. When receiving data through CAN, the problem of CAN sending will not occur.The can module will stop sending data for a period of time if it is just sending.
linux can driver description can be found in Linux Manual in Linux L4.14.98_2.0.0 Documentation
For qnx issues please apply to qnx tech support.
Best regards
igor
Hi anbang
qnx is not supported by nxp, issue may be posted on qnx support portal:
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
It should be a CAN driver problem.Can you provide examples of iMAX6Q CAN drivers.