- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am Working with PSoC6 prototype kit on SMIF block. I need example on usage of Interrupts with QSPI.
Thank you for your Help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Sri_08 ,
Apologies. I missed using the API's to set the interrupt in the SMIF block.
Just enabling the interrupts in Device Configurator will not activate the same.
Please use the following code snippet after initialization to activate the interrupts:
Cy_SMIF_SetInterruptMask(SMIF_BLOCK_BASE,
Cy_SMIF_GetInterruptMask(SMIF_BLOCK_BASE) |
( SMIF_MEMORY_MODE_ALIGMENT_ERROR ? CY_SMIF_ALIGNMENT_ERROR : 0 ) |
( SMIF_RX_DATA_FIFO_UNDERFLOW ? CY_SMIF_RX_DATA_FIFO_UNDERFLOW : 0 ) |
( SMIF_TX_COMMAND_FIFO_OVERFLOW ? CY_SMIF_TX_COMMAND_FIFO_OVERFLOW : 0 ) |
( SMIF_TX_DATA_FIFO_OVERFLOW ? CY_SMIF_TX_DATA_FIFO_OVERFLOW : 0 )
);
You can then test if the interrupts are operational using the Cy_SMIF_SetInterruptMask() API.
I have modified the previously shared project to do this and it demonstrates triggering all the 4 interrupts using the Cy_SMIF_SetInterruptMask() API.
Warm Regards
Alen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Sri_08 ,
In this case I would recommend you to start with the mtb-example-psoc6-qspi-readwrite code example and build from the same.
This code example uses the library for serial-flash (which you can also enable in your project from library manager).
The QSPI initialization routine used in this code example ( cy_serial_flash_qspi_init() ) configures the interrupt in the same for the QSPI block by default. You can hence register a callback to the read interrupt using the cy_serial_flash_qspi_read_async() API so that you get an interrupt each time your read completes and also manage the interrupt priority using the cy_serial_flash_qspi_set_interrupt_priority() API.
Also attaching here a modified version of this code example that uses the cy_serial_flash_qspi_read_async() API with interrupts to demonstrate its use.
Note: In the attached example, after every read, it waits in a while loop for the smifReadCmpltFlag flag to be set from the interrupt callback before moving forward.
Hope this helps.
Warm Regards
Alen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey @AlenAn14
Thank you for your Help. I am working on SMIF block with the help of PDL API's. So if I can get example with the help of PDL API's it would be very helpful for me.
Thank you so much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Sri_08 ,
Can you please let me know if you are interfacing the QSPI block of PSoC 6 with an external memory like NOR Flash?
In which case do you require a interrupt based PDL equivalent of the mtb-example-psoc6-qspi-readwrite code example which uses HAL?
Warm Regards
Alen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @AlenAn14 ,
Yes I'm interfacing NOR flash with qspi block. I want interrupt based on data overflow and underflow for TX and RX FIFOs.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Sri_08 ,
I have created an example where the interrupts for TX/RX FIFO overflow is enabled from device configurator using PDL API's in the ISR routine of the SMIF block.
I have not tested if the overflow and underflow interrupts will trigger, but the read complete and write complete interrupts do trigger after a read or the write to the external flash device.
Attaching the same here. Please check and let me know if this helps.
Warm Regards
Alen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @AlenAn14 ,
I have also enabled the Interrupts from device configurator but I want to know how to call them through code and to know which interrupt Is occured.
In the code you have shared above I haven't found any api related to Interrupt
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Sri_08 ,
Apologies. I missed using the API's to set the interrupt in the SMIF block.
Just enabling the interrupts in Device Configurator will not activate the same.
Please use the following code snippet after initialization to activate the interrupts:
Cy_SMIF_SetInterruptMask(SMIF_BLOCK_BASE,
Cy_SMIF_GetInterruptMask(SMIF_BLOCK_BASE) |
( SMIF_MEMORY_MODE_ALIGMENT_ERROR ? CY_SMIF_ALIGNMENT_ERROR : 0 ) |
( SMIF_RX_DATA_FIFO_UNDERFLOW ? CY_SMIF_RX_DATA_FIFO_UNDERFLOW : 0 ) |
( SMIF_TX_COMMAND_FIFO_OVERFLOW ? CY_SMIF_TX_COMMAND_FIFO_OVERFLOW : 0 ) |
( SMIF_TX_DATA_FIFO_OVERFLOW ? CY_SMIF_TX_DATA_FIFO_OVERFLOW : 0 )
);
You can then test if the interrupts are operational using the Cy_SMIF_SetInterruptMask() API.
I have modified the previously shared project to do this and it demonstrates triggering all the 4 interrupts using the Cy_SMIF_SetInterruptMask() API.
Warm Regards
Alen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you @AlenAn14
I have implemented the above example so here we are activating the Interrupts which we have enabled in device configurator. When I'm implementing I'm not able to get the which interrupt is triggered we can know this from Cy_SMIF_GetInterruptStatusMasked(base) here we are setting mask for particular Interrupt but from status it is showing nothing. Can you please provide solution for this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Sri_08 ,
I did not quite get what you meant by "but from status it is showing nothing".
Is it that the ISR routine , SMIF_Interrupt_User(), is getting triggered, but the if else condition jumps to the final else case with the statement "printf("[ SMIF IRQ ] : Undefined Error \r\n");" ? meaning that an undefined interrupt has been triggered?
Warm Regards
Alen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @AlenAn14
My doubt is as per the above example you have provided we are setting an interrupt mask using particular API and we are calling function only to set those Interrupts but in the ISR we are reading status Cy_SMIF_GetInterruptStatusMasked(base) at that time I'm getting zero for every interrupt and also we are not calling ISR in main function then how it will trigger
Sorry for late response
Thanks