滚印车间
您当前的位置:贴片加工 > 基础知识

关于DSP28379D的CAN通信问题

时间:2023-06-13 10:30:36  来源:  浏览量:

我根据TI给出的can-loopback例程,然后把IO口改掉,环回模式是对的,之后把环回模式 // Enable test mode and select external loopback HWREG(CANA_BASE + CAN_O_CTL) |= CAN_CTL_TEST; HWREG(CANA_BASE + CAN_O_TEST) = CAN_TEST_EXL;给注释掉,波特率也设定好了,连接一个CAN分析仪后,发现dsp的数据不能发送出去,请问还需要修改其他地方嘛?这是我的程序,十分感谢各位前辈的指导。

main(void){ tCANMsgObject sTXCANMessage; tCANMsgObject sRXCANMessage; // Step 1. Initialize System Control: InitSysCtrl(); // Step 2. Initialize GPIO: InitGpio(); //GPIO70 - CANRXA GPIO_SetupPinMux(17, GPIO_MUX_CPU1, 2); //GPIO71 - CANTXA GPIO_SetupPinMux(12, GPIO_MUX_CPU1, 2); GPIO_SetupPinOptions(17, GPIO_INPUT, GPIO_ASYNC); GPIO_SetupPinOptions(12, GPIO_OUTPUT, GPIO_PUSHPULL); // Initialize the CAN controller CANInit(CANA_BASE); // Setup CAN to be clocked off the M3/Master subsystem clock CANClkSourceSelect(CANA_BASE, 0); CANBitRateSet(CANA_BASE, 200000000, 50000); // Step 3. Clear all interrupts and initialize PIE vector table: // Disable CPU interrupts DINT; InitPieCtrl(); // Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000; InitPieVectTable(); // Enable test mode and select external loopback // HWREG(CANA_BASE + CAN_O_CTL) |= CAN_CTL_TEST; // HWREG(CANA_BASE + CAN_O_TEST) = CAN_TEST_EXL; // Enable the CAN for operation. CANEnable(CANA_BASE); // Initialize the message object that will be used for sending CAN // messages.The message will be 4 bytes that will contain an incrementing // value.Initially it will be set to 0. *(unsigned long *)ucTXMsgData = 0; sTXCANMessage.ui32MsgID = 1; // CAN message ID - use 1 sTXCANMessage.ui32MsgIDMask = 0; // no mask needed for TX sTXCANMessage.ui32Flags = MSG_OBJ_TX_INT_ENABLE;// enable interrupt on TX sTXCANMessage.ui32MsgLen = sizeof(ucTXMsgData); // size of message is 4 sTXCANMessage.pucMsgData = ucTXMsgData; // ptr to message content // Initialize the message object that will be used for recieving CAN // messages. *(unsigned long *)ucRXMsgData = 0; sRXCANMessage.ui32MsgID = 1; // CAN message ID - use 1 sRXCANMessage.ui32MsgIDMask = 0; // no mask needed for TX sRXCANMessage.ui32Flags = MSG_OBJ_NO_FLAGS; sRXCANMessage.ui32MsgLen = sizeof(ucRXMsgData); // size of message is 4 sRXCANMessage.pucMsgData = ucRXMsgData; // ptr to message content // Setup the message object being used to receive messages CANMessageSet(CANA_BASE, 5, &sRXCANMessage, MSG_OBJ_TYPE_RX); // Enter loop to send messages.A new message will be sent once per // second.The 4 bytes of message content will be treated as an unsigned // long and incremented by one each time. for(;;) { // Send the CAN message using object number 1 CANMessageSet(CANA_BASE, 1, &sTXCANMessage, MSG_OBJ_TYPE_TX); // Now wait 1 second before continuing DELAY_US(1000*1000); // Get the receive message CANMessageGet(CANA_BASE, 5, &sRXCANMessage, true); // Ensure the received data matches the transmitted data if((*(unsigned long *)ucTXMsgData) != (*(unsigned long *)ucRXMsgData)){ asm(" ESTOP0"); } // Increment the value in the transmitted message data. (*(unsigned long *)ucTXMsgData)++; asm(" ESTOP0"); }}

  • Maxim为真无线耳机提供供电与通信MAX20340 通过单触点同时提供充电与通信,大幅减小尺寸、降低成本、提高可靠性中国,北京—Maxim Integrated Products, Inc (NASDAQ: MXIM) 宣布推出业界最小的 2 引脚双向直流

  • STM32与BQ2060a通信问题STM32与BQ2060a通信问题我使用407芯片 原子哥的模拟IIC 与BQ2060a通信想读取电池组的电压 容量 温度等数据但是读取数据都是3F00 或者7F3F 或者3FFF等数据经过拿示波器观测,

  • 有一个20KW英飞源电源模块,有大佬知刚收到一个英飞源电源模块,没办法输出电压电流,有大佬知道通信协议吗?可以具体介绍下
    还能描述再少点吗?你这样让人猜?
    型号等有关资料提供一下这个一般都是有通讯协议的,可以上其

  • 开关变压器信息的介绍开关变压器信息的介绍
    1.“开关变压器”一般是指“开关电源”里面所用的变压器,工作在十几到几十千赫兹频率的脉冲状态下,铁芯一般采用铁氧体材料。
    2.开

  • 推荐资讯
    相关文章
    栏目更新
    栏目热门
    关于我们
    电脑周边
    家用电器
    通讯
    地区
    新闻中心
    深圳贴片加工厂
     
    • ☆电源板
    • ☆U盘
    • ☆网卡
    • ☆显卡
    • ☆监控摄像头
    • ☆电脑主板
    • ☆平板电脑主板
    • ☆DVD主板
    • 解码板
    • 伺服板
    • 高频头板
    • 复读机板
    • 音响主板
    • ☆手机主板
    • ☆手机按键板
    • ☆无线电话机
    • ☆对讲机主板
    • ☆深圳
    • 东莞
    • 广州
    • 龙岗
    • 宝安
    • 龙华
    • 坂田