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.

TMS470 dcan interrupt handler

Other Parts Discussed in Thread: TMS470MF06607, HALCOGEN

hi,

i am using TMS470MF06607 microcontroller . in TMS470M  MCU development kit.

i can transmit and receive the data  using pooling method . but i dont know how to transmit and receive using INTERRUPT HANDLER.

in  canInit() function , in the CAN control register i am enable the EIE & SIE bits  . (DCAN1).

I am using the DCAN1 for TRANSMIT (message object :1) and  RECEIVE (message object :2).

qus 1 :  i put the CAN transmit and receive functions in the scheduler. at the first time my RECEIVE function block the coding . once the receive function, receive                 any  data means after that its not block the code .    ( i put transmit  function in 1 sec .      and  receive function  in 20msec ) .  

             at first the data want to be receive , until  the transmit function was blocked .  after receive one time its not block the transmit function.

ques 2 :  if i want to use the INTERRUPT HANDLER .  

                after transmit the data my code going to the can1HighLevelInterrupt() function , in this at first time its go into the canErrorNotification() function , and the                  next time only its go into the canMessageNotification() . i dont know how to use this functions, and what change i want to do in this functions . 

               i tried few things in this functions, but its not affect any change in the CAN registers  (contol register &  error and status register  & interrupt register ) .

is any one can explain me how to use the interrupt handler functions . ??

thanks

arun

  • Hi Arun,
    Are you using a RTOS? I will suggest that you separate out the RTOS from the CAN interrupt operation. This way you can debug the CAN interrupt in isolation from the OS. First try to see if the interrupt can work properly in a non-OS environment.

    BTW, there is a HalCoGen example for CAN in interrupt mode. If you are in HalCoGen, try to create a new project for a device like 570LS31x. Once the project is created you can go to Help->Help Topics->Examples where you will find the example_canIntCommunication.c. Click on it, it will show you some instructions to setup the CAN in interrupt mode. You can mimic the same setup and code in your 470M device.
  • hi sir,
    yes, i am using the RTOS . i checked that halcogen example CAN interrupt handler.
    now i checked that code with out & with RTOS . its working good.

    sir , i have one more doubt on this . at first time why its going into canErrornotification() function.

    regards
    arun
  • Hi,
    So you are getting some type of error. Please read the DCAN ES (Error and Status) register. What does it show?
  • hi sir,

    after the DCANInit() function, my register values are
    ctrl - 0x0003140E, ES - 0X00000007 , ERRCnt- 0X00000000 , BTR - 0X00001453, INR - 0X00000000.

    at first i am transmit my data , after transmit the data my register value.
    ctrl - 0x0003140E, ES - 0X00000008 , ERRCnt- 0X00000000 , BTR - 0X00001453, INR - 0X00008000.
    here till the INR register clear ,the code is in the canmessagenotification() function only. when the INR register will clear its come out from the interrupt handler.

    at the second time i receive the data , before receive the register values are
    ctrl - 0x0003140E, ES - 0X00000007 , ERRCnt- 0X00000000 , BTR - 0X00001453, INR - 0X00000000.

    when my data receive , first its going to interrupt handler
    ctrl - 0x0003140E, ES - 0X00000008 , ERRCnt- 0X00000000 , BTR - 0X00001453, INR - 0X00008000 , its going into the can error notification() function. then after the INR register value is INR-0X00000002.

    after receive the register values are
    ctrl - 0x0003140E, ES - 0X00000010 , ERRCnt- 0X00000000 , BTR - 0X00001453, INR - 0X00000002 .
    here also until the INR register value is changed to zero its keep on rotate in the interrupt handler only (canhighlevelinterrupt() function).

    regards
    arun
  • Do you have SIE (bit 2) of DCAN CTL register set? If set, then you get an interrupt on every status change.
  • hi sir,

    yes sir , i am enabling that SIE ( bit 2) of DCAN CTL register.

    thank you
    arun kumar
  • If that has answered your question, please click the green "Verify Answer" button above.