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.

c6454 GPIO HWI

Other Parts Discussed in Thread: TMS320C6454

Hi, I am trying to use a GPIO signal as a HWI on a TMS320C6454 DSP. The HWI I created is never executed.

I will try to explain what I am doing to set up the HWI.

Let's say I'd like to use GP[6] rising edge for the HWI. In main(), I configured the GPIO registers as follows: GP[6] is set as an input (in GPIO_DIR), BINTEN is set to 1, and the corresponding bit for GP[6] in RIS_TRIG is set.

Also in main(), this line executes:

C64_enableIER(C64_EINT6);

And these two lines are in the DSP/BIOS Config:

bios.HWI.instance("HWI_INT6").fxn = prog.extern("hwi_gpio6_rising_edge");
bios.HWI.instance("HWI_INT6").interruptSelectNumber = 57;

I have verified the GPIO input is changing. The hwi just does not execute.

  • I saw in your original post that you used interruptSelectNumber=54 and was going to point out that this is the EDMA event value, not the correct Interrupt value but I see you have corrected your post. I take it that this was not the issue preventing the HWI from executing?

    Can you confirm that the appropriate bit in the IER is enabled when running C64_enableIER()? Do you ever see the IFR bit set (you may not see this if the IER bit is set)? I don't see in your tcf code snippet where you enable the Interrupt Dispatcher (bios.HWI.instance("HWI_INT6").useDispatcher = 1;) - is this included in your TCF script? The Dispatcher takes care of all the state saving when entering/exiting the interrupt, so without this your code may get lost.

    Finally, you mentioned that the GPIO input is changing, but I could not discern whether or not you confirmed this by watching the signal externally or internally (watching the IN_DATA register). You may want to ensure that the GPIO module is configured correctly inside the device and that the GPIO value is changing inside the IN_DATA register.

  • Hi, thanks for the reply. I realized that I incorrectly used the select number = 54 instead of 57, and I tried it after correcting that, but it didn't help. So I updated the original post.

     

    In my original post I forgot to put in the line: "bios.HWI.instance("HWI_INT6").useDispatcher = 1;", which actually was in my tcf file.

    I verified the GPIO input changed both externally (probing the signal) and internally (seeing IN_DATA bit 6 change). I am using a switch I temporarily hooked up to it.

    My GPIO functionality is working well as I have done other things with the GPIO peripheral already (including programming an fpga via slave serial mode), so I don't think my GPIO handling is the problem.

     

    In main() right after the call to [C64_enableIER(C64_EINT6)], IFR = 0x00004000, IER = 0x00000043.

    After DSP/BIOS starts, IFR = 0x00000000, IER = 0x00004043.

     

    Thanks,

    Steve

  • I have figured out the problem to my issue. I was calling printf() within my HWI. According to "Table A-2 RTS Function Calls" in Appendix A of spru403o, "TMS320C6000 DSP/BIOS 5.32 Application Programming Interface (API) Reference Guide", you cannot call printf() from a HWI. That is what caused my program to not work properly.

     

    The IFR bit did set and my routine was called during the HWI now.

     

    Steve

     

  • Steve,

    I am glad to hear that you found the issue with the ISR, and thank you for posting your solution here!

  • You just saved me a lot of time. Thanks.

    As a quick follow up. To debug a HWI, enable monitoring in DSP/BIOS Config, compile and load, and then go to the DSP/Bios=>Statistic View and add the INTX_STS ...

     

  • Thanks for sharing what caused your problem as well as your tips.  FYI, just want to make sure you guys know about the wiki:

    http://wiki.davincidsp.com/

    These articles mention not being able to call printf from an HWI:

    http://wiki.davincidsp.com/index.php?title=DSP_BIOS_Debugging_Tips

    http://wiki.davincidsp.com/index.php?title=DSP_BIOS_FAQ

    If you poke around a bit I'm sure you'll find other articles that help you too!

    Brad