- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am using a Wiced board BCM920737TAG_Q32 and trying to configure it as a SPI master board. After programming, when I see over the oscilloscope I can see just the SCLK signal of 9MHz but I am not able to see any data that I transmit over MOSI line.
The CS and MOSI are also configured in the function but I cant see them changing in the O-scope. I am using the example code of spi_pressure_sensor.c for testing the SPI.
I also did created my own smart design project and check SPI in the configuration. Then I used the sample functions defined in the pdf "WICED Smart Hardware interfaces in the application note" to transmit data over SPI: spiffy2_master_send_receive_byte(UINT8 byteToSend); , I actually declared this function outside of all the functions. and then called it in an interrupt handler.
UINT8 spiffy2_master_send_receive_byte(UINT8 byteToSend)
{
BYTE byteReceived;
// SPIFFY2 is now ready to be used.
// Assert chipselect by driving O/P on the GPIO
gpio_setPinOutput(CS_PORT, CS_PIN, CS_ASSERT); // Assert chipselect
// Tx one byte of data
spiffyd_txData(SPIFFYD_2, 1 ,&byteToSend); // Send a byte
// Rx one byte of data
spiffyd_rxData(SPIFFYD_2, 1, &byteReceived); // Read 1 byte
// Deassert chipselect
gpio_setPinOutput(CS_PORT, CS_PIN, CS_DEASSERT); // Deassert chipselect
return byteReceived;
}
Solved! Go to Solution.
- Labels:
-
GPIO
-
MasterSlave
-
SDK 2.X
-
SPI
-
Timers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry for the late reply. Thanks jakewtorres and kwang for your help, I got success in communicating with I2C with the gyroscope, that issue is solved. The gyroscope is now fully working.
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bluetooth Multi-Sensor Development Board - Anaren Atmosphere Wiki
You can buy a board here: A20737A-MSDK1 - Octopart
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kwang,
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jacob can help you with I2C and gyro if you still need the help, if not please let us know also.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry for the late reply. Thanks jakewtorres and kwang for your help, I got success in communicating with I2C with the gyroscope, that issue is solved. The gyroscope is now fully working.
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please create a new thread for the display issue.