Unable to set the CYW920706WCDEVAL dev kit as spi slave

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

cross mob
lock attach
Attachments are accessible only for community members.
igloc_3085191
Level 2
Level 2
First like received

Hi all,


I am having troubles trying to configure the CYW920706WCDEVAL dev kit as spi slave. On the Wiced Studio 6.2 SDK, I could not find any example that implements a spi slave.

So I have tried to use the code snippet and configuration that comes on the  CYW920706WC DEVAL Hardware User Guide (Section 10.3). Unfortunately that configuration will not worked. I have also tried most of the configurations that comes within the SDK, on the spiffydriver.h (up to 87 possible configurations there).

I have throughly tested the following:

- SPI master device sends data correctly. Tested on scope (CS, CLK and MOSI). Also it works perfectly with a thrid party spi slave device.

- I have checked several times that the connections are correctly set as the recommended configuration (hw guide).

- The spi slave library init is correctly call on initialization. I can see the traces via UART.

- There are no other GPIOs used on the code.

I have attached the spi master files that I use on the project. Also on the application main code, the following functions are called:

            nov_spi_slave_init();

            spi_register_tx_rx_handler(nov_spi_slave_handle_tx_and_rx);    

            nov_spi_slave_register_data_received_cb(nov_spi_slave_data_received);

When the data is called the MOSI line is held high. The callback function is not reached at any point.

I have attached the spi_slave code that I have put together.

Any help will be most welcome. Please let me know if you need any other further info.

Thanks

8 Replies
lock attach
Attachments are accessible only for community members.
igloc_3085191
Level 2
Level 2
First like received

So I have kept testing. This is a project with the very basic spi driver using wiced_transport. I have been testing several conifg (including the recomended on the hw guide). The only that will not upset my spi slave device coms is the one in use (SLAVE1_P32_CS_P36_CLK_P33_MOSI_P05_MISO). The device is not receiving data yet.

0 Likes

Adding the applications team anpm grsr gyan riya rroy shjl wwfe

0 Likes
igloc_3085191
Level 2
Level 2
First like received

I have been trying to use the hal_spi library to create an spi/master simple communication between two dev kit. I have used the code snippets included in the  CYW920706WCDEVAL Hardware User Guide (section 10.2 and 10.3). The problem is that it seems difficult to have an asynchronous communication between both examples. The slave example calls the function wiced_hal_pspi_rx_data that specifies that 'Receive data over SPI as the master. Assumes that the slave/chip select line will be active throughout the transaction.' So it seems that CS should be already asserted when this function is called, but the function is called straight on. According to the hal_spi documentation the CS interrput for the slave is called within the hal_spi library. Therefore I would expect an option to configure a callback function within the hal_spi library when data is received. But there is no such an option like that for any of the function neither wiced_hal_pspi_init which should be the function to register a rx callback function. I am quite confused at the moment.

0 Likes

Can u share two very simple spi examples that only do the following and work for the CYW920706WCDEVAL dev kit?

- One spi master example that will send a byte every sec and toggle the D10 LED.

- Another spi slave example that will be waiting to rx a byte and toggle the D10 LED on every byte rx.

I am really expecting some help with this ...

0 Likes

Hi,

I will try a simple SPI code on CYW20706 EVAL and will share.

Meanwhile you may try from your side referring demo code of chip 20719 (APIs are almost identical. But pin configurations will be different) (Path in WICED studio : /20719-B1_Bluetooth/apps/snip/hal/spi_slave and... /20719-B1_Bluetooth/apps/snip/hal/spi_master)

Thanks,
Anjana

0 Likes
lock attach
Attachments are accessible only for community members.

Hi anpm

I have modified the snippet code examples that you reffered to in order to work with the CYW920706WCDEVAL dev kit. I have done some simple modifications for both examples on the uart and spi pin configurations. The spi master is working correctly. I can see the output data on the MOSI. CS and CLK lines are working fine.

The spi_master is not receiving the data. The CLK line is held. I have tried other pin configurations without luck. I have also modify the uart switch to not overlap with the pin in use.

Please provide a sample spi_slave code that will work with the spi_master code attached. Please also inform if there is any required specific configuration to set on the CYW920706WCDEVAL dev kit switches.

Best Regards,

Ignacio

0 Likes
lock attach
Attachments are accessible only for community members.

Hi,

Attached the code SPI master and slave.

Please test and let us know if you face any problem.

Please use shorter wires for SPI connection.

Thanks,
Anjana

Refer the project here: SPI example for CYW20706

Please try with the same pin configurations given in the page for testing.