SPI keep sending

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

cross mob
MaMa_4034336
Level 3
Level 3

Hello,

I'm currently trying out the "UsbSpiDmaMode" example and when i try so send data to my sensor, the CYUSB3KIT-003 keep sending data over spi and doesn't stop.

Also the LED2 (the Blue one) keep glowing, but i think that's because SSN is connected to the led.

best regards,

Matthias

0 Likes
1 Solution
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi Matthias,

The SPI example you are referring to has Erase since it writes to the Flash Memory (which requires flash to be done before writing)

Regarding sampling: The configurability is in CPOL and CPHA (As you might know which is configurable through CyU3PSpiConfig_t structure passed in CyU3PSpiSetConfig API)

Sending and receiving on different edges of the same clock is not possible.

It is possible to vary word lengths. (I suppose you may want to assert and deassert the SSN for every word). But once the word length is configured, it remains same until you reconfigure the SPI block again. It is not possible to dynamically change the word length while the transfer is going on.

Regards,

Hemanth

Hemanth

View solution in original post

0 Likes
3 Replies
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi Matthias,

You are correct. The LED2 (of USB Super Speed Explorer Kit) glows when the SSN is asserted (active low).

Please check if the firmware is stuck in CyFxSpiWaitForStatus() of CyFxSpiTransfer().

Please share the UART logs.

Regards,

Hemanth

Hemanth
0 Likes

Hello Hemanth,

I don't know why, but the UART doesn't work in this firmware for me, but I tested, where it get stucked, with the CyU3PDeviceReset(CyFalse) function. It get stuck in the CyFxSpiTransfer(). However it think it didn't quite understood, what the project do. I used it to send one SPI command (about 1-3 Bytes) to a sensor, but the programm is only used to send multiple of 256 bytes to a flash. Thats also the reason why there is a Erase function?

EDIT:

is it possible to change the CLK sampling from frist rising edge to falling ege.

My sensor read data on the risign edge, but it sending the data on a falling edge.

Also is it possible to send SPI word with different bit length, because i have to send 10 Bit adresse and then send 16 Bit Data or read 16 Bit data.

best regards,

Matthias

0 Likes
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi Matthias,

The SPI example you are referring to has Erase since it writes to the Flash Memory (which requires flash to be done before writing)

Regarding sampling: The configurability is in CPOL and CPHA (As you might know which is configurable through CyU3PSpiConfig_t structure passed in CyU3PSpiSetConfig API)

Sending and receiving on different edges of the same clock is not possible.

It is possible to vary word lengths. (I suppose you may want to assert and deassert the SSN for every word). But once the word length is configured, it remains same until you reconfigure the SPI block again. It is not possible to dynamically change the word length while the transfer is going on.

Regards,

Hemanth

Hemanth
0 Likes