Has anyone set up an IRQ for SPI Slave mode with Rowley Crossworks ?
i am having trouble figuring out how you set up the IRQ handler for that.
Has anyone set up an IRQ for SPI Slave mode with Rowley Crossworks ?
i am having trouble figuring out how you set up the IRQ handler for that.
Rowley supplies a STM32_Startup.s file which initializes the stack pointer, the heap and also has stubs for all the interrupts.
In your program, you name your interrupt handler routine with the appropriate name. For example for the SPI1, there is a vector in STM32_Startup.s called SPI1_IRQHandler. In your code, you would add a:
voide SPI1_IRQHandler(void)
{
your code
return;
}
and the linker will point the interrupt vector in STM32_Startup.s to your code.
Thanks, I am using the LPC1754, and i see what you are talking about in LPC1700_Startup.s
i added:
void SPI_IRQHandler(void)
{
FIO0PIN ^= BIT0; // toggle IO to monitor with scope.
return;
}
Yet this IRQ never fires. I have the SPI set up as a slave an i am receiving data and echoing it back to the master just fine. i also have the SPIE bit set to enable IRQ for SPI.
S0SPCR |= (1 << 7); // IRQ Enable
I am assuming there must be something else to do for the compiler.
I’m struggling to think why this would be a compiler issue.
If you have it working in programmed I/O mode, I wonder if you have an issue with the interrupt not being enabled or the interrupt priority is too low.
I’m not familiar with the LPC1754 but I’m guessing there is an interrupt pending flag in the SPI block, I would clear that and then after you have done some transfers, use the debugger to stop the program and check if the interrupt request flag is set. You can then start chasing where it is getting blocked.
I’m struggling to think why this would be a compiler issue.
I am not saying its a compiler issue. what i am saying is that there is not enough documentation for the compiler for one to set it up.
I have done all that i can for enabling the interrupt in code. what i need to know is how do i tell the compiler where to jump to when the IRQ for SPI is triggered. I also need to know how to properly set up the IRQ because i am using a CTL project and i dont know how that IRQ will affect the rest of the CTL project.
When you made the modification to LPC1700_Startup.s, you setup the interrupt handler for the SPI interrupt. If the SPI interrupt happens, it should go here.
Since it isn’t firing, I would suggest following the SPI interrupt request and enable flags to figure out why the SPI interrupt handler didn’t get called.
In addition, I would check that the LPC1700_Startup.s you modified is actually used. One “easy” way to do this is to put an error in the file and the compiler/assembler should complain. Another way would be to call your interrupt routine from your main code and make sure it does the right thing.
There is some discussion on the Rowley support forums, so you might want to also look there.
Sorry I couldn’t help more.
thanks for your help, i wound up using the SSP0 instead and now things are working just fine.