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.

HWI interrupt not working.

Other Parts Discussed in Thread: DAC8564, SYSBIOS

Hi,

I am using my custom board and I want to use HWI on TM4C123BH6ZRBI. For this I am configuring SPI for EOT interrupt which will be set when the last bit is transfered from the master.

Here is my code snippet(only the relevant code)---

void GPIO_SSI_ISR(UArg instance)
{

// Clear the End of transmission Interrupt bit

//
HWREG(SSI2_BASE + SSI_O_ICR) |= SSI_TXEOT;

// Event posted to Thread waiting for End of transmission Interrupt
Event_post( evSSIHandle, Event_Id_00);
}

int main()

{

......

//
// Board Initialization
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_2 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |SYSCTL_XTAL_16MHZ);

.......

......

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA|SYSCTL_PERIPH_GPIOB|SYSCTL_PERIPH_GPIOC|
                                             SYSCTL_PERIPH_GPIOD|SYSCTL_PERIPH_GPIOE|SYSCTL_PERIPH_GPIOF|
                                             SYSCTL_PERIPH_GPIOG|SYSCTL_PERIPH_GPIOH|SYSCTL_PERIPH_GPIOJ|
                                             SYSCTL_PERIPH_GPIOK|SYSCTL_PERIPH_GPIOL|SYSCTL_PERIPH_GPIOM|
                                             SYSCTL_PERIPH_GPION|SYSCTL_PERIPH_GPIOP|SYSCTL_PERIPH_GPIOQ);

//
// Create Hwi to register the HWI ISR with the TIVA
//

hwiHandle = Hwi_create(INTNO, GPIO_SSI_ISR, &hwiParams, &eb);    //INTNO => 73

//Return Hwi handle error
if(hwiHandle == NULL)
{
rtrn_stats = ERROR_INVALID_HWIHANDLE;
}

// Enable SSIModule

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2 );

//
// Multiplex SSI functionality
//

ROM_GPIOPinConfigure(SSI2CLK);

ROM_GPIOPinConfigure(SSI2RX);

ROM_GPIOPinConfigure(SSI2TX);

//
//Configure Pin as SSI
//
ROM_GPIOPinTypeSSI(GPIO_PORTB_BASE, GPIO_PIN_4|GPIO_PIN_6|GPIO_PIN_7);

//
//Configure Pin for chip select
//
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE,CS_ADC);

ROM_GPIOPinTypeGPIOOutput(GPIO_PORTQ_BASE,CS_DAC|CS_FLASH); 

ROM_SSIConfigSetExpClk(SSI2_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_3,
SSI_MODE_MASTER, SysCtlClockGet()/8, 8);

//
// Enable the SSI2 module.
//
ROM_SSIEnable(SSI2_BASE);

while (ROM_SSIDataGetNonBlocking(SSI2_BASE, &dummyRead)) {
}

//
// Enable SSI2 Interrupt
//
ROM_IntEnable(INT_SSI2 );

// Enable End of Transmission Interrupt and Default value

SSIRIS |= SSIINTBIT ;
//
// Enable the SSI2 module.
//

........

........

}

So for each data transfer on SPI slave(DAC8564 in my case), my ISR, GPIO_SSI_ISR should be hit in which I am posting an event as evident from the code, but this is not happening. Rather I am getting below error message:

ti.sysbios.knl.Event: line 205: assertion failure: A_badContext: bad calling context. Must be called from a Task.
xdc.runtime.Error.raise: terminating execution

Can anyone guide me if I am missing anything in the code in order to generated HWI or can anybody give me the simple steps to configure an HWI interrupt using SPI EOT interrupt and execute the ISR.

Any sample code for such scenario will help.

Regards,

Mritunjai

  • I have observed this problem on the TM4C1294. The SSI_TXEOT interrupt is not generated reliably.

  • Your post's subject/title provides, "No Clue" as to your profoundly specific SSI focus.

    Those with SSI expertise/interest may not easily/quickly be lured by such vagueness.

    And - rarely is the HW interupt, "not working."  Far more often - user's code and/or understanding - warrants that description...

    Responding poster provides some confirming feedback (albeit different MCU) - might a check of most recent errata save others' time/effort?  (along w/edit of subject/title to better, "announce" your post's objective...)

  • Mritunjai Singh said:
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA|SYSCTL_PERIPH_GPIOB|SYSCTL_PERIPH_GPIOC|
                                                 SYSCTL_PERIPH_GPIOD|SYSCTL_PERIPH_GPIOE|SYSCTL_PERIPH_GPIOF|
                                                 SYSCTL_PERIPH_GPIOG|SYSCTL_PERIPH_GPIOH|SYSCTL_PERIPH_GPIOJ|
                                                 SYSCTL_PERIPH_GPIOK|SYSCTL_PERIPH_GPIOL|SYSCTL_PERIPH_GPIOM|
                                                 SYSCTL_PERIPH_GPION|SYSCTL_PERIPH_GPIOP|SYSCTL_PERIPH_GPIOQ);

    You, can only assign one parameter to SysCtlPeripheralEnable(). So, this won't work. 

    You would need to enable each peripheral per SysCtlPeripheralEnable call.

    - kel

  • Thanks for the replies. Nice to know that this forum is actively read.

    Yes. This was a user error. I was trying to switch in and out of loopback mode and it seems that the module clears interrupt flags when changing modes.

    I was not able to use interrupts effectively for the device that I am communicating with because the framing signal output is too fast. The ST microelectronics L6470 motor driver requires a minimum deselect time of 800ns to process each byte and a select time of 350ns before clocking. With the SSI module generating a frame deselect of only one clock tick, I have to either slow the bit rate considerably from 5 Mhz or generate the chip select timing using processor loops.

    I have the option of configuring the drivers in a daisy-chain. This way I can transfer a byte to and from all motor drivers between each framing signal. Aside from the extra code complexity, the problem with this configuration is that the processor time to rearrange bytes nearly matches the transmission time.

    To better support this type of device interface, it would be nice to have a more flexible configuration of the frame select signal generation. Perhaps a register to control the frame deselect clock ticks and another to control the delay before clocking after frame select active.

    Best regards,

    Bob Rice

  • Hello Bob

    Can you please send the code that you are having trouble with getting EOT Interrupt reliably?

    The EOT interrupt is generated only when the FIFO is empty and the last bit is shifted out from the holding buffer.

    Regards

    Amit

  • Hi Amit,

    I only had a problem losing an EOT interrupt when I was switching modes. My interface is working fine although I have to use processor loop timing to generate a frame select signal compatible with the L6470 motor drivers.

    Bob

  • Hello Bob,

    EOT interrupt "must" always be generated when the serial stream is done. I am not sure what you mean by switching modes: Is it the setting of CPH and CPO? Even if the switching is done after sending the transfer the EOT will happen.

    Regards

    Amit