This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DSP28377D CAN通信问题

Other Parts Discussed in Thread: CONTROLSUITE

我想问一下:

我在调试CAN通信的时候,用controlSUITE里边的can_loopback_interrupts_cpu01进行测试,如果完全采用例程的程序进行回环测试,不看是不是有输出,是不是就不需要考虑程序里选用的CAN接口与DSP实际与CAN芯片接口是哪个引脚?

但是我的程序会一直停在这里:

//###########################################################################
;// $TI Release: F2837xD Support Library v160 $
;// $Release Date: Mon Jun 15 13:36:23 CDT 2015 $
;// $Copyright: Copyright (C) 2013-2015 Texas Instruments Incorporated -
;// http://www.ti.com/ ALL RIGHTS RESERVED $
;//###########################################################################

.def _F28x_usDelay
.sect "ramfuncs"

.global __F28x_usDelay
_F28x_usDelay:
SUB ACC,#1
BF _F28x_usDelay,GEQ ;; Loop if ACC >= 0
LRETR

;There is a 9/10 cycle overhead and each loop
;takes five cycles. The LoopCount is given by
;the following formula:
; DELAY_CPU_CYCLES = 9 + 5*LoopCount
; LoopCount = (DELAY_CPU_CYCLES - 9) / 5
; The macro DELAY_US(A) performs this calculation for you

我的板子上DSP引脚GPIO36、37,与CAN芯片相连,将对应的IO配置之后:

//GPIO30 - CANRXA
GPIO_SetupPinMux(36, GPIO_MUX_CPU1, 6);
//GPIO31 - CANTXA
GPIO_SetupPinMux(37, GPIO_MUX_CPU1, 6);
GPIO_SetupPinOptions(36, GPIO_INPUT, GPIO_ASYNC);
GPIO_SetupPinOptions(37, GPIO_OUTPUT, GPIO_PUSHPULL);

其他地方不变,观察寄存器可以看到接收发送寄存器都有数据,但是CAN分析仪观察不到数据。

将如下程序注释掉,通过CAN分析仪连接CAN芯片的H和L观察。

// HWREG(CANA_BASE + CAN_O_CTL) |= CAN_CTL_TEST;
// HWREG(CANA_BASE + CAN_O_TEST) = CAN_TEST_EXL;


// Check the error flag to see if errors occurred
//if(g_bErrFlag)
//{
//asm(" ESTOP0");
//}

观察寄存器,可以看到发送数据在变,但是can分析仪仍然观察不到数据。

希望能帮我分析一下问题所在,谢谢!!

  • 最好这样    你用示波器看看CANH和CANL上是否有波形波形    

    频率和你设置的一致     这样肯定是有数据发出来了

    然后接收CAN分析仪     如果还接收不到    检测连线和120欧电阻是否正确