cyw54907 WICED_SPI_2

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

cross mob
hoainguyen265
Level 3
Level 3
5 likes given 25 sign-ins 10 replies posted

Hi guys,

I'm using WICED_SPI_2 in cyw54907 but got  unexpected issues that:

my external SPI slave transfer 8 byte

{0x01, 0x02, 0x03...,0x08}

but cyw54907 received 8 byte:

{0x81, 0x02, 0x03, 0x04, 0xFF, 0xFF, 0xFF, 0xFF}

And in the external SPI slave side i got event that only transfer 4 byte data

 

This is my setup in cyw54907:

init

 

    spi_device.bits = 8;
    spi_device.port = WICED_SPI_2;
    spi_device.speed = 1000000; //1Mhz
    spi_device.mode = (SPI_CLOCK_RISING_EDGE | SPI_CLOCK_IDLE_LOW| SPI_MSB_FIRST);
    auto result = wiced_spi_init(&spi_device);

 

received data

 

    wiced_spi_message_segment_t message;
    memset(&message, 0, sizeof message);
    message.rx_buffer = data;
    message.tx_buffer = 0;
    message.length = len;
    if (wiced_spi_transfer(&spi_device, &message, 1) != WICED_SUCCESS) {
        return 1;
    }

 

0 Likes
1 Solution
    spi_device.bits = 8;
    spi_device.port = WICED_SPI_2;
    spi_device.speed = 1000000; //1Mhz
    spi_device.chip_select = WICED_GPIO_NONE;
    spi_device.mode = (SPI_CLOCK_RISING_EDGE | SPI_CLOCK_IDLE_LOW| SPI_MSB_FIRST);
    auto result = wiced_spi_init(&spi_device);

This WICED_GPIO_NONE save my day 😄

spi_device.chip_select = WICED_GPIO_NONE;

 

View solution in original post

0 Likes
6 Replies
hoainguyen265
Level 3
Level 3
5 likes given 25 sign-ins 10 replies posted

I change my set up to WICED_SPI_1 and received full data from external SPI slave

 

    spi_device.bits = 8;
    spi_device.port = WICED_SPI_1;
    spi_device.speed = 1000000; //1Mhz
    spi_device.chip_select = WICED_GPIO_22;
    spi_device.mode = (SPI_CLOCK_RISING_EDGE | SPI_CLOCK_IDLE_LOW| SPI_MSB_FIRST);
    auto result = wiced_spi_init(&spi_device);

 

So it's mean that my external SPI slave is not wrong.

0 Likes
YashM
Moderator
Moderator
Moderator
First question asked 250 sign-ins 100 replies posted

Hi

Do you mean, by using WICED_GPIO_1 you are able to receive the entire data (0x01, 0x02...0x08) correctly? 

Regards

0 Likes

Thanks for reply sir,

I change my setup from WICED_SPI_2 to WICED_SPI_1 and received the entire data.

YashM
Moderator
Moderator
Moderator
First question asked 250 sign-ins 100 replies posted

Hi 

That sounds good!

But I don't see you have used spi_device.chip_select = WICED_GPIO_41 for WICED_SPI_2.

Can you please try that and confirm once?

Regards 

0 Likes

Change SPI port from WICED_SPI_2 to WICED_SPI_1 is just a way to test my external SPI,

i want to resolve the problem with the WICED_SPI_2 because my schematic using this SPI port.

Btw, if i set spi_device.chip_select = WICED_GPIO_41

wiced_spi_init will return error. So i think that the WICED_SPI_2 use some default configs.

0 Likes
    spi_device.bits = 8;
    spi_device.port = WICED_SPI_2;
    spi_device.speed = 1000000; //1Mhz
    spi_device.chip_select = WICED_GPIO_NONE;
    spi_device.mode = (SPI_CLOCK_RISING_EDGE | SPI_CLOCK_IDLE_LOW| SPI_MSB_FIRST);
    auto result = wiced_spi_init(&spi_device);

This WICED_GPIO_NONE save my day 😄

spi_device.chip_select = WICED_GPIO_NONE;

 

0 Likes