Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
batuhan
Level 1
Level 1
First question asked Welcome!

"Hello,

I've written my SPI initialization code for the cyusb3kit-003 as follows:

/* SPI initialization for application. */
CyU3PReturnStatus_t CyFxSpiInit(uint16_t pageLen)
{
CyU3PSpiConfig_t spiConfig;
CyU3PReturnStatus_t status = CY_U3P_SUCCESS;

/* Start the SPI module and configure the master. */
status = CyU3PSpiInit();
if (status != CY_U3P_SUCCESS)
{
return status;
}

/* Start the SPI master block. Run the SPI clock at 8MHz
* and configure the word length to 8 bits. Also configure
* the slave select using FW. */
CyU3PMemSet((uint8_t *)&spiConfig, 0, sizeof(spiConfig));
spiConfig.isLsbFirst = CyFalse;
spiConfig.cpol = CyTrue;
spiConfig.ssnPol = CyFalse;
spiConfig.cpha = CyTrue;
spiConfig.leadTime = CY_U3P_SPI_SSN_LAG_LEAD_HALF_CLK;
spiConfig.lagTime = CY_U3P_SPI_SSN_LAG_LEAD_HALF_CLK;
spiConfig.ssnCtrl = CY_U3P_SPI_SSN_CTRL_FW;
spiConfig.clock = 4000000;
spiConfig.wordLen = 8;

status = CyU3PSpiSetConfig(&spiConfig, NULL);

return status;
}

 

However, when I load and run the code on the device and check the SPI clock pin with an oscilloscope, I don't see 4 MHz. Instead, I'm getting an inexplicable value like 1.9 kHz. What could be the reason?

0 Likes
1 Solution
narolkarvarun
Moderator
Moderator
Moderator
100 solutions authored 250 replies posted 50 solutions authored

Hi batuhan,

Can you please confirm if you are currently in boot mode? Could you also share the SPI analyzer traces with us and confirm if you are using the latest SDK version 1.3.5?

please try with given example given in SDK C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples

Thank you

Varun Narolkar

 

View solution in original post

0 Likes
1 Reply
narolkarvarun
Moderator
Moderator
Moderator
100 solutions authored 250 replies posted 50 solutions authored

Hi batuhan,

Can you please confirm if you are currently in boot mode? Could you also share the SPI analyzer traces with us and confirm if you are using the latest SDK version 1.3.5?

please try with given example given in SDK C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples

Thank you

Varun Narolkar

 

0 Likes