TMS320F280039C: CAN通訊配置

Part Number: TMS320F280039C
Other Parts Discussed in Thread: C2000WARE

如何使用寄存器配置CAN通信,是否有demo程序,需要查詢發送,中斷接收,使用掩码。原因是以前的项目使用的是寄存器配置,现在需要加入CAN通讯功能,使用库去配置CAN可以正常工作,但是使能CAN中断之后,其他中断就无法中断了。

  • 您好,

          c2000ware中有示例代码,请参考下面链接内容。

          can (ti.com)

          

  • 在CAN使能中断后,ADC就无法进入中断,屏蔽掉CAN中断后,ADC就可以正常进入ADC中断?为什么会有冲突?

  • 您好,

         如果这两个模块使用的管脚没有冲突的话,请参考前面链接中中断优先级示例程序。

         

  • 感谢您的回复,不过还是没有得到解决。下面是我的代码,帮忙查看查看哪里错误

    void main(void)
    {

    Device_init();

    // Initialize PIE and clear PIE registers. Disables CPU interrupts.
    Interrupt_initModule();

    //
    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR).
    //
    Interrupt_initVectorTable();

    Device_initGPIO();

    CanAInit(500000);

    Interrupt_register(INT_CANA0,&canaISR);
    Interrupt_register(INT_ADCA1, &adcA1ISR);

    initEPWMGPIO();

    configureADC(ADCA_BASE);


    SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);


    EPWM_configureSignal(EPWM1_BASE, &pwmSignal1);
    EPWM_configureSignal(EPWM2_BASE, &pwmSignal2);
    EPWM_configureSignal(EPWM3_BASE, &pwmSignal3);


    configureOSHTripSignal(EPWM1_BASE);

    //
    // Configure ADCEVTx as cycle-by-cycle trip signal for ePWM2
    //
    configureCBCTripSignal(EPWM2_BASE);

    //
    // Configure ADCEVTx as direct trip signal for ePWM3
    //
    configureDirectTripSignal(EPWM3_BASE);


    configureADCSOC(ADCA_BASE, 2U);


    configureLimitDetectionPPB(0U, 3600U, 0U);


    // Interrupt_enable(INT_ADCA1);
    Interrupt_enable(INT_CANA0|INT_ADCA1);

    CAN_enableInterrupt(CANA_BASE, CAN_INT_IE0 | CAN_INT_ERROR);
    CAN_enableGlobalInterrupt(CANA_BASE, CAN_GLOBAL_INT_CANINT0);
    CAN_clearGlobalInterruptStatus(CANA_BASE, CAN_GLOBAL_INT_CANINT0);

    EINT;
    ERTM;

    ADC_forceSOC(ADCA_BASE, ADC_SOC_NUMBER0);
    CAN_startModule(CANA_BASE);

  • 您好,

          请参考前面回复链接中的"sw_prioritized_isr_levels.h" ,检查中断优先级。