SPI is tricky to get working initially if you do not start with one of our sample apps.
Trying using both /WICED-Smart-SDK/Apps/spi_comm_master and /WICED-Smart-SDK/Apps/spi_comm_slave in conjunction with one another and see if this works better as a starting point.
Thanks for replying, I see that it is tricky to get working.
Did you mean to use 2 similar modules as to configure Master and Slave and then see the communication with one another. Actually I did not understand your reply properly, it would be very helpful for me if you simplify you answer.
There is a Windows app under /WICED-Smart-SDK/Apps/spi_comm_slave
My understanding is that this application is used to test 2 BCM20737 TAG boards connected over the SPI interface.
I have a SPI fully functional on the Macnica Mpression Odyssey board, let's see if I can help.
Couple of questions....
- What type of SPI slave do you have ?
- What GPIO PORT did you select (spiGpioConfig) ?
- Is you Chip Select active low or high on your slave?
- What polarity do you need (data read on clock rising edge, falling edge?)
- Have you looked at the dual bonded GPIOs to make sure you disable the one you are not using?, see the note below.
Note from the datasheet:
"On some packages, two or more GPIOs may be bonded together. If a bonded GPIO is to be used for SPI, then the other GPIO must be configured with the input and output disabled using the GPIO driver API before configuring SPIFFY. See the documentation that accompanies the BCM20732 module for more information on bonded GPIOs".
Ans 1. I am not using any SPI slave, I am trying to look at the MOSI data on an oscilloscope. I do not see a single frame of data on the scope.
Ans 2. I used the following configuration:
SCLK MOSI MISO
P03 P02 P01
Ans 3. Chip select is active low
Ans 4. I am using Mode 0 for SPI which is CPOL = 0, CPHA = 0.
Ans 5. I have looked into that and the pins are not dual bonded.
I have a question: Do I need to connect a slave in order to use SPI? What if I do not connect that? Can I still see the signal on a Scope?
You will need a SPI slave to be able to spy the communication. I believe you may see the clock going out and that's about it in case no slave is connected.
The tag board may also watchdog reboot in case you are not connecting a slave. The tag is actively waiting on MISO and no data is available.
If you want to look at the SPI communication in details I would recommend to take a look at the Anaren board. You have the accelerometer connected via SPI to the BCM20737, you can easily access the pins and monitor the transaction.
You can buy a board here: A20737A-MSDK1 - Octopart
In my case I was outputting MOSI on P38 but was unable to see it on my scope because of a miswire that connected P38 to ground or some voltage that was acting like a pull up or down and swamping my MOSI logic signals. Once I corrected the miswire, the MOSI was visible on the scope.
Also, did you say SCLK is 9 MHZ.. I thought the upper limit was six MHZ.
I using p01, p02, p03 for SPI communication and they do not have any dual pinout. So I think that miswire might not be a problem in this case. Also the board looks clean and there is no shortings between the pins.
Yes I was seeing on the scope and I see the periodicity of the SPI clock as 9 MHz.
I am also trying to interface I2C Gyro but not getting success in writing or reading register address and data over I2C lines. It would be helpful if you guide me through this.
I am also interfacing a small screen, ST7735, with WICED and am finding some difficulty with that. I have written all the data structures for filling the up the display RAM to display characters and also the spiffy Tx and Rx functions to write in the display RAM. I have written fill screen and display character functions but it gets stuck in part of a 'for' loop in the structure. (The example code I am working off for the display, for a TI microcontroller, uses a command list style structure for display commands and a for loop to execute it)
Is there any way I can see the advanced runtime debug and values of the SPI data registers?
Thanks for your help!
Please create a new thread for the display issue.