- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I configured SPI block on FX3 using this example: cyfxusbspiregmode – SPI in Register Mode. However, for my application I need to enable interrupt. I will be sending data from FPGA through SPI at any point, so I need to enable RX DONE register. The thing is I know where it's located and know general structure, but don't know how to implement it in C code, since there is no example for SPI interrupt registers. There are examples for GPIO interrupts though.
Thanks!
Solved! Go to Solution.
- Labels:
-
USB Superspeed Peripherals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
When a callback function is given as the second parameter in the 'CyU3PSpiSetConfig()' API instead of 'NULL', all the SPI event interrupts are enabled in the firmware internally. The prototype of SPI event callback function is given in FX3APIGuide page no. 455. Let us know if any help is needed
Best Regards, AliAsgar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
When a callback function is given as the second parameter in the 'CyU3PSpiSetConfig()' API instead of 'NULL', all the SPI event interrupts are enabled in the firmware internally. The prototype of SPI event callback function is given in FX3APIGuide page no. 455. Let us know if any help is needed
Best Regards, AliAsgar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reply,
So, I first register callback function using: CyU3PRegisterSpiCallBack ( SpiServiceRoutine), then I pass it to CyU3PSpiSetConfig (&spiConfig, SpiServiceRoutine). Then use servie routine as:
void SpiServiceRoutine(CyU3PSpiEvt_t evt, CyU3PSpiError_t error) {
swtich(evt){
case CY_U3P_SPI_EVENT_RX_DONE: don something
}
}
Is my idea right.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
There is no need of registering the callback function using the CyU3PRegisterSpiCallBack() API. The callback function(SpiServiceRoutine) can be defined in the code, and can be used directly in the CyU3PSpiSetConfig() API.
Best Regards, AliAsgar