- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I hope we can change the SPI CPOL/ CPAH by a command from Host by any time . I can not find any examples like it. So i try to do it by call CyU3PSpiSetConfig, but when I do it, the firmware will become frozen. Maybe someboby can tell me the true way. thanks!!
case SPI_SET_CPOL_LOWHIGH:
if(wIndex==0)
{
g_spiConfig.cpol = CyFalse;
}
else
{
g_spiConfig.cpol = CyTrue;
}
status = CyU3PSpiSetConfig(&g_spiConfig, NULL);
break;
Solved! Go to Solution.
- Labels:
-
USB Superspeed Peripherals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Zhao,
Please try the following approach when you want to change the CPOL and CPHA and let me know if it helps:
1. Stop the application: This step will involve cleaning the DMA channel, destroying the channel (if SPI is used in DMA mode) and de-initialize the SPI block.
2. After this, try configuring the SPI block again by setting the required parameters and using the API CyU3PSpiSetConfig ()
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Please let us know your exact requirement so that we can help you better. Based on my understanding, you would like to change CPHA and CPOL on the run (i.e modify the initial configuration). Please confirm if my understanding is correct. Please correct me if my understanding is wrong.
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Jayakrishna,
Thanks for your reply, You are right , I want to change the CPOL and CPAH when the firmware is running. So that my firmware can adapt any SPI device with different configures (CPOL and CPAH).
Best Regards,
Zhao
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Zhao,
Please try the following approach when you want to change the CPOL and CPHA and let me know if it helps:
1. Stop the application: This step will involve cleaning the DMA channel, destroying the channel (if SPI is used in DMA mode) and de-initialize the SPI block.
2. After this, try configuring the SPI block again by setting the required parameters and using the API CyU3PSpiSetConfig ()
Jayakrishna