SPI flow control

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

cross mob
Anonymous
Not applicable

Hi,

     When I trace the sample codes of SPI COMM (slave or master), there is always a flow control pin (input/output). Is this mandatory to make sure the data transmission is correct? According to the SPI protocol, there is not necessary to have flow control port.

BR,

Forrest

0 Likes
1 Solution
asridharan
Employee
Employee
10 comments on KBA 5 comments on KBA First comment on KBA

Flow control lines for SPI are not a requirement from the point of view of SPI, but is required from a more general, application level protocol. The TX and RX FIFOs are 16 bytes deep and since BT is higher priority than the application thread, you may overflow/underflow either/both these FIFOs. You also need a mechanism to wake the 2073x before you send it some data over SPI because the SPI HE block is turned off in sleep.

View solution in original post

9 Replies
asridharan
Employee
Employee
10 comments on KBA 5 comments on KBA First comment on KBA

Flow control lines for SPI are not a requirement from the point of view of SPI, but is required from a more general, application level protocol. The TX and RX FIFOs are 16 bytes deep and since BT is higher priority than the application thread, you may overflow/underflow either/both these FIFOs. You also need a mechanism to wake the 2073x before you send it some data over SPI because the SPI HE block is turned off in sleep.

Anonymous
Not applicable

So if I need to make 2073x as SPI slave mode, I need to config the CS pin as interrupt and add extra GPIO as output flow control pin, like the sample codes do. Am I right?

0 Likes

> So if I need to make 2073x as SPI slave mode, I need to config the CS pin as interrupt and add extra GPIO as output flow control pin, like the sample codes do. Am I right?

Yes.

0 Likes
Anonymous
Not applicable

Can you provide more information on FIFO overflow/underflow? and the 16 byte buffer management technique?  I don't see this discussed in detail in the documentation.  I am specifically interested in BMC20737 TAG board using SPIFFY2 as Master, sending and receiving data one byte at a time.  I seem to be able to send only 7 or 8 bytes and then it hangs and the system restarts.

0 Likes

This looks like the same line of questioning you created here Re: SPI SPIFFY2 MASTER TAG BMC20737 Only Xmits 7 bytes, here: Re: BCM20737TAG SPI timing and within several other existing threads on the forum.

jose.raffucci did a good job in the first thread of explaining how to start with a basic configuration, then begin to tweak and add to that configuration to suit your application's needs.

In addition, we also offer a spi_comm_master example with the SDK (/apps) along with a Hardware Interfaces Guide which you may find helpful: WICED™ Smart Hardware Interfaces

There are alot of users here on the community that have gotten the SPI to work,so hopefully they will be able to provide some ongoing guidance as well.

0 Likes
Anonymous
Not applicable

Yes, I did find the Hardware Interfaces Guide to be very helpful and especially the  spi_comm_master example which is what I based my application on.  As I mentioned it works fine for up to seven bytes of transmission then it hangs.  I also scoured the spiffy2 driver header file provided for any clues and found non that would help.

What might be helpful is if you could direct me to some documentation that describes the "theory of operation" of the system, including all timers and sleep modes and the processing of interrupts and I/O, etc.  The "how to program Wiced Smart Apps" document touches on some of these topics but it's rather sketchy.

I'm looking for info on how to use the fine timer, and when the system goes into sleep mode and how to disable sleep mode (on the chance that it might be causing my trouble)

0 Likes

Unfortunately, a theory of operations document like you describe does not exist.  Typically what customers do is get one of the sample applications working, then start to slowly convert that into an application to suit their own use case/application.

This thread contains code for entering sleep mode: BCM20736S Sleep Example Firmware

The Blog here also explains sleep mode in some degree: WICED Smart Video BLOG: Experts Interview - Sleep Deep_Sleep and Advertising

To disable sleep mode ("hidoff" is the keyword to search on), this is a popular thread: How to enter HIDOFF? How to detect if the request is not honored?

Anonymous
Not applicable

We started with the HeartRateMonitor sample application and have it communicating with an iPhone.  I am implementing a Texas Instrument ADC (24 bit) interface via SPI.  Perhaps the HR Monitor was not the best choice for me to build off of.  Maybe I'll look at the "hello sensor" app for some ideas of implementing non-native (external to TAG board) hardware interfaces.

0 Likes

Providing examples for interfacing to external sensors/MCUs over SPI/UART is an area where we could definitely improve. The good news is that alot of users here on the community have worked through the details, so I'm hoping some of them can provide guidance as well.

spi_pressure_sensor under the /apps directory is a decent example to use in this scenario.

* SPI Pressure Sensor Sample

*

* This application provides the sample code interfacing the MS5525DSO

* pressure sensor (http://www.meas-spec.com/product/pressure/MS5525DSO.aspx)

* over the SPI interface.  The application initializes the second SPI interface

* to communicate with the sensor to get calibration data then read the pressure

* and temperature which is displayed on the debug UART.  See application note

* http://www.amsys.de/sheets/amsys.de.an520_e.pdf on the calculation details.

*

* Features demonstrated

*  - Use of the SPI driver interface

*  - Reading data from MS5525DSO pressure sensor

*

* To demonstrate the app, work through the following steps.

* 1. Connect MS5525DSO pressure sensor to SPI interface

*    (Use P24 for CLK, P4 for MOSI and P25 for MISO)

* 2. Plug the WICED eval board into your computer

* 3. Build and download the application (to the WICED board)

* 4. Application reads pressure and temperature information from MS5525DSO

*    every second and prints it out to the debug output.