element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
STM32F4DISCOVERY Expansion Boards
  • Products
  • Dev Tools
  • STM32F4DISCOVERY Expansion Boards
  • More
  • Cancel
STM32F4DISCOVERY Expansion Boards
Forum Discover Wi-Fi Module SPI Communication
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join STM32F4DISCOVERY Expansion Boards to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 58 replies
  • Subscribers 7 subscribers
  • Views 7032 views
  • Users 0 members are here
  • wifi
  • stm32f4
  • discovery
  • spi
  • discover
Related

Discover Wi-Fi Module SPI Communication

Former Member
Former Member over 10 years ago

I've been messing around for days and have been unable to get the SPI communication with the Wi-Fi module to work, it would never respond at all. I couldn't get the demo UART code to respond either, but I need SPI for the increased bandwidth anyways. Am I doing something wrong, like missing a setup step or something? I'm not even sure if I connected the correct pins on the board, as there are 2 sets of SPI pins (SPI and SPI3), and I'm not 100% sure of which pin is the "ALRT" pin. I couldn't even get that interrupt to fire, despite numerous attempts to send data to the module. Does anyone have some working SPI code and wiring? I'm kind of at a loss here. I've put the code is this gist and this gist (too many lines to paste here), it looks rather shoddy as I was trying various things to get the module to do anything at all. I tried both DMAs and straight up interrupts, though I'd prefer to use DMAs to save CPU cycles.

  • Sign in to reply
  • Cancel

Top Replies

  • michaelkellett
    michaelkellett over 10 years ago in reply to Former Member +1
    Before you spend your money why not at least try to code it so that your waveforms look exactly like those on the data sheet ? And try clocking data out only when it's ready. These things might not make…
  • Former Member
    Former Member over 10 years ago in reply to michaelkellett +1
    Hi Michael, Thank you for your insight into SPI communication. I implemented that, driving a GPIO but with S/W and asserting prior to read/write and de-asserting when complete and it has improved communication…
Parents
  • michaelkellett
    0 michaelkellett over 10 years ago

    Unless you know exactly how the logic inside the Murata chip is implemented then some of your questions can't be answered, for example

    "NSS won't be high for very long, no? In that case it might as well be held low continuously."

     

    For all you or I know there is some edge triggered thing inside the Murata chip which has to be operated for it to work correctly - I've certainly designed FPGA SPI ports where the rising edge on NSS clears some internal error states in the SPI peripheral - I understand that this is common.

     

    So you need to do exactly what the data sheet says as far as possible.

    It is not clear if yout should raise/lower NSS after each byte or not - you'll need to test.

    But this section from the serial interface manual is clear enough:

     

    When the SN8200 module has data, it indicates to

    the host by asserting a dedicated GPIO line (ALRT/). The signal transitions from high to low to signal the

    event, and returns to the high state prior to the completion of the current data transfer. If the host connects

    this signal to an interrupt line, then upon receiving the GPIO interrupt, the host may assert NSS and start

    clock to initiate data transfer from the module. In the case when the GPIO interrupt pin is not available on

    the host, it may assert NSS and send clock periodically to poll data from the module

     

    They obviously expect NSS to be asserted at the start of each read out operation so by implication it must be de-asserted at the end of each.

     

    With regard to timing, while they show MISO from the ls bit persisting until just after NSS goes high they do NOT show this for MOSI, there should be no problem using any reasonable (ST is included) SPI interface.

    I would not be using DMA until it was working properly without.

    Since Murata don't spec the gap between NSS rising and NSS falling I suggest you play it safe and give it several PCLK times. And make sure you observe tsu(nss) and th(nss)  - which requires you to know the clock speed of the Murata chip.

     

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to michaelkellett

    Hi Michael,

    Thank you for your insight into SPI communication. I implemented that, driving a GPIO but with S/W and asserting prior to read/write and de-asserting when complete and it has improved communication considerably. The sn8200 still seems a little wonky. If I disconnect form the AP it seems to have a *lot* of difficulty reconnecting. Once connected however, it reports a good connection about 1 1/2 s following reset. I've recoded the S/W that manages this to not disconnect - just shutdown when not needed. The sn8200 stores connection information in NVM and uses that on the next restart. (I need to see if it stores the shutdown too. Parhaps the code should just pull power or assert reset when WiFi is not needed.

     

    thanks,

    hank

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to Former Member

    Combing through the "SNIC Serial Interface Specification" v2.6 I find a message that the host must send to the SN8200 in response to the WIFI_NETWORK_STATUS_IND message with the SCID WIFI_NETWORK_STATUS_CFM. The value for this SCID is not documented in the file nor can I find it used in any of the example code. It must be important otherwise it would not be described.

     

    What is the correct value for this? Can I guess it is the same as WIFI_NETWORK_STATUS_IND? Maybe WIFI_NETWORK_STATUS_IND|0x80?

     

    thanks!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 10 years ago in reply to Former Member

    @hankb

       This document looks like a very low level guide to writing TCP/IP at the socket layer or UDP. Is there another interface that is more high level?

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to clem57

    Not that I am aware of.

     

    The package which can be downloaded from Element14 includes sample code for the UART version.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 10 years ago in reply to Former Member

    Not sure of your host, but this seems like a possibility based on gcc toolchain http://www.broadcom.com/products/wiced/wifi/

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 10 years ago in reply to clem57

    This http://www.element14.com/community/message/95583/l/wifi-sn8200#95583 led me to the link btw

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to clem57

    Hi Clem,

    From the discussions I'd seen about WICED I had the impression that it was intended to customize the firmware on the SN8200. Our desire is to use the SN8200 as a peripheral for another system and using the factory firmware on the sn8200 itself. Are you suggesting that WICED can be used to develop S/W to run on another processor (such as a Discovery board) and interface with the sn8200?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 10 years ago in reply to Former Member

    Hi Hank,

         From what I can tell Broadcom sold the chip to Murata about 1-2 years ago. So if the firmware should be based on Broadcom then it could already be WICED capable without firmware changes. I do not have this, so you would need to try. I would be interested in the results which ever way you decide to go.

    Hope this helps,

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 10 years ago in reply to clem57

    Found it! http://wireless.murata.com/RFM/data/wiced_application_development_with_sn82xx_evk.pdf This PDF shows how to use WICED with the SN8200 board.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to clem57

    Hi Clem,

    Thanks for the info and the help. That describes programming the EVB. That's not what we want to do. Our plan is to use the sn8200 (sn8205 actually) as to provide a way for another processor to communicate with a host PC via WiFi. We don't plan to program our application on the sn8200 itself. We thought we could do this by using the published APIs for the sn8200. I have not been entirely successful getting that to work.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 10 years ago in reply to clem57

    Hi Clem,

    Thanks for the info and the help. That describes programming the EVB. That's not what we want to do. Our plan is to use the sn8200 (sn8205 actually) as to provide a way for another processor to communicate with a host PC via WiFi. We don't plan to program our application on the sn8200 itself. We thought we could do this by using the published APIs for the sn8200. I have not been entirely successful getting that to work.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • Former Member
    0 Former Member over 10 years ago in reply to Former Member

    For my latest adventure I'm trying to implement the ACK bit in the protocol. It appears that the checksum is calculated differently when that bit is set and the response that I'm seeing is not well formed. I expect 02 80 80 FF FF 04. Instead I see 80 80 FF FF 04. Following the mal-formed ACK there is a normally formed sn8200 reply.

     

    I've attached sample code that demonstrates this (as well as using DMA) with some instructions on how to run it in the README.txt. (and a git repo with code committed before I made any changes.) On my PC this is in C:\STM32Cube_FW_F4_V1.4.0\Projects\STM32F429I-Discovery\Examples\SPI.

    Attachments:
    SPI_FullDuplex_ComDMAsmplMurata.zip
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube