cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

New Contributor

How to make it work when CyU3PSpiSetConfig() called repeatedly to change the settings?

the example code as the following, but it not work.

example code:

CyU3PSpiConfig_t spiConfig;

spiConfig.wordLen    = 10;

CyU3PSpiSetConfig (&spiConfig, NULL);

CyU3PSpiSetSsnLine (CyFalse);

CyU3PSpiTransmitWords (addr, addrbytecnt);

spiConfig.wordLen    = 8;

CyU3PSpiSetConfig (&spiConfig, NULL);

CyU3PSpiTransmitWords (data, DataByteCount);

CyU3PSpiSetSsnLine (CyTrue);

0 Likes
Reply
1 Solution
Moderator
Moderator

Hi,

Yes it is possible to change SPI configurations dynamically. PFA firmware which is used to change the SPI config wordlength using control center. You have to send the vendor command and use wIndex field to set the desired wordlength. Changes will be highlighted in the debug prints.

Thanks & Regards
Abhinav

View solution in original post

0 Likes
Reply
6 Replies
Moderator
Moderator

Hi,

Which transfer mode are you using.

If the DMA mode is used, the DMA channel(s) need to be reset after each fresh CyU3PSpiSetConfig API

call.

Please refer to the FX3API Guide section 5.32.4.7 for further reference.

Thanks & Regards

Abhinav

0 Likes
Reply
New Contributor

Hi,

using SPI reg mode.

How to do for SPI reg mode to fresh CyU3PSpiSetConfig API call?

0 Likes
Reply
Moderator
Moderator

Hi,

Are you able to change the SPI configuration for the first time. I tried and changed the clock, it worked fine. I am sending the vendor command in which I am calling SpiInit2(), which is re-configuring the Spi clock.

I am attaching the firmware, you can take it as reference.

Thanks & Regards

Abhinav

0 Likes
Reply
New Contributor

Hi Abhinav,

It's not work when call the CyU3PSpiSetConfig() repeatedly to change the SPI word length in a function call.

Could you provide the example code for changing different SPI Word length dynamically?

0 Likes
Reply
New Contributor

Hi, Abhinav,

Any update?

Is the FX3 HW SPI not support for changing different SPI Word length in the SSL active interval dynamically?

0 Likes
Reply
Moderator
Moderator

Hi,

Yes it is possible to change SPI configurations dynamically. PFA firmware which is used to change the SPI config wordlength using control center. You have to send the vendor command and use wIndex field to set the desired wordlength. Changes will be highlighted in the debug prints.

Thanks & Regards
Abhinav

View solution in original post

0 Likes
Reply