14 Replies Latest reply on Feb 11, 2015 7:33 PM by gptechinno

    SN8200 SPI message format

    hbarta

      I have loaded SN8200-SNIC-SPI-03-4.0.2.bin on a Discovery-WiFi board and am working on getting communications going using SPI (To an STM32F429I-DISCO board.) At present I can receive the replies for WIFI_GET_STATUS_REQ and WIFI_GET_STA_RSSI_REQ. Unfortunately they do not look like what I expect (based on the documentation and experience with the UART version of the code. An example reply is:

       

      [code]

      0x02SOM
      0x88L0 - 8
      0x81L1 - 1<<7 128 => payload length = 136?
      0xD0Command ID - WiFi (Next 10 bytes are payload)
      0x84WIFI_GET_STATUS_RSP
      0x00sequence
      0x00status code 0 => WiFi off
      0x01MAC00
      0x0A"0B
      0x0D"6C
      0x40"41
      0x89"88
      0xC8"C8
      0xD8

      0x05

      0x04

      [code]

       

      There's enough there to look like a frame, but some things are clearly wrong. For example, the length looks off. There is certainly not 136 bytes of data. The payload looks like it should be 10 bytes. The MAC address is also wrong for the most part.

       

      I have tried slowing the SPI clock to the lowest data rate (328.125 KBits/sec) and that makes no difference. I send the request repeatedly and the only thing that changes in the reply is the sequence number. It does not look like a noisy line problem.

       

      Could I have a voltage mismatch? I'm using a 3.3V device and I thought the Murata ran at that level too.

       

      What could be causing this problem?

       

      Thanks!

       

      keith randerson yfang@murata.com hhyogo dan

        • 1. Re: SN8200 SPI message format
          randerson

          Hello,

           

          This does not appear to be a voltage mismatch issue.  3.3V is perfectly fine to use.  It looks like you are missing/adding a bit here and there.  I have not seen anything like this before.  Can you send me a scope trace of the reply data below to look at?

           

          Thanks,

          Ryan Anderson

          randerson@murata.com<mailto:randerson@murata.com>

          +1-678-684-2004

          • 2. Re: SN8200 SPI message format
            hbarta

            Hi Ryan,Here are two images that I captured. (I'm working from home today and only have an ancient CRT type 'scope available.)

            DSC_0069-PP.JPG

             

            Top trace is the clock and second is MOSI. Both channels set to 2V/div and sweep is 2 microseconds/div. The trace is triggered from channel 2 which seems to show the data stream better. This is the slowest speed configurable (using STM32CubeMX) and works out to 328.125 KBits/sec. Clock phase is first edge and polarity is low.

             

            Here is the inbound (MISO) data:

            DSC_0070-PP.JPG

            If I go with a little slower time base I can actually see the sequence number count up, at least the higher order bits.

             

            Let me know if there is something else you wanted me to show with the scope trace.

             

            thanks,

            hank

             

            Edit: Hera are the settings for the firmware I am using onFirmware Settings.PNG the Discovery-WiFi.

            • 3. Re: SN8200 SPI message format
              randerson

              Hi Hank,

               

              The pictures are a little hard to make out.  Everything looks okay, but it would be nice to have slightly better images to look at.  Will you have access to a better scope in the next few days?

               

              Regards,

              Ryan

              • 4. Re: SN8200 SPI message format
                hbarta

                Yes, I will probably be able to do that sometime this week.

                 

                Thanks,

                hank

                 

                edit: note to self - do not reply to forum posts via email!

                • 5. Re: SN8200 SPI message format
                  hbarta

                  Hi Ryan,

                  I hope these are sufficient. The top trace (yellow) is the clock, second (purple) is MOSI and third (green) is MISO. NSS is held to ground. This is a portion of the request to the SN8200.

                  IMG_20150203_090942-1.jpg

                   

                  The second picture is a portion of the reply from the SN8200.

                  IMG_20150203_091141-2.jpg

                   

                  Are these sufficient? Is there anything else you want to see?

                   

                  thanks,

                  hank

                  • 6. Re: SN8200 SPI message format
                    randerson

                    Hi Hank,

                     

                    The second picture is a little confusing to me.  You should only see the MISO pin be active during a replay.  What is the MOSI doing?  This might be messing the radio up.  You have to wait for the reply before you can send more data.  The first image looks okay.

                     

                    Regards,

                    Ryan

                    • 7. Re: SN8200 SPI message format
                      hbarta

                      Hi Ryan,

                      SPI is a master slave protocol. In order for the slave to transmit, the master must also transmit and provide the clock. From Serial Peripheral Interface Bus - Wikipedia, the free encyclopedia :

                      During each SPI clock cycle, a full duplex data transmission occurs. The master sends a bit on the MOSI line and the slave reads it, while the slave sends a bit on the MISO line and the master reads it. This sequence is maintained even when only one-directional data transfer is intended.

                      (emphasis mine)

                       

                      I hope this clears up the confusion.

                       

                      thanks,

                      hank

                      • 8. Re: SN8200 SPI message format
                        hbarta

                        Hi Ryan,

                        I have hooked up a/an SPI protocol analyzer and what I see from the analyzer does not match what the program reads off the SPI bus. That points to misconfiguration in the program, I think.

                         

                        I need to look at this further and will let you know what I find.

                         

                        thanks,

                        hank

                         

                        Edit: Just to be clear - "the program" I refer to above is the program running on the SPI master, not the S/W running in the SN8200.

                        • 9. Re: SN8200 SPI message format
                          hbarta

                          I'm 99% certain that there is something in the host SPI configuration causing this problem. I am able to take one of the STM32Cube library SPI examples and exchange messages with the Murata board without difficulty (except mid-week when all communications stopped.) I have since purchased another Discovery-WiFi board which performs as did the original before it quit. In other words, the SPI connection no longer works on the original though the board itself still seems to work. (AP goes on when I power it up.)

                           

                          Does the Discovery-WiFi communicate only on the one SPI port? The Discovery WiFi show another (SPI1) and part of a third (SPI.) I've been using SPI3.

                           

                          I'm also looking for the /ALRT signal on the Discovery-WiFi board (and have another post regarding that)

                           

                          Thanks!

                          • 10. Re: SN8200 SPI message format
                            randerson

                            Yes, the module with our codeload will communicate on the one SPI port.

                             

                            Regards,

                            Ryan

                            • 11. Re: SN8200 SPI message format
                              hbarta

                              Hi Ryan,

                              Thank you for confirming that.

                               

                              Do you have any information on my other query? (/ALRT signal on Discovery-WiFi)

                               

                              best,

                              hank

                              • 12. Re: SN8200 SPI message format
                                randerson

                                Hi Hank,

                                 

                                By default the Alert signal is P43 (Interrupt) of the module.  It is connect to pin 17 of J6.

                                 

                                The blue LED is connected to the MOSI pin which is also LED-net.

                                 

                                I hope that this helps.

                                 

                                Regards,

                                Ryan

                                • 13. Re: SN8200 SPI message format
                                  hbarta

                                  Thank you for that information.

                                  • 14. Re: SN8200 SPI message format
                                    gptechinno

                                    Dear hbarta,

                                     

                                    i spent many month with this SN8200 in SPI and the STM32F4, and one of the many strange (undocumented) behavior of SN8200 is that the SPI bus is half duplex mode (first you send information, then you read the reply), but during the reply reading on MISO, the MOSI pin MUST be sending only 0xFF values, so pin MUST be high all the time, other wise the SN8200 corrupt data. At least with SNIC-SPI-03-37191 and SNIC-SPI-03-44041 FW version (I never tried the latest version you are using, because I spend so many time debugging in the dark these old version, I don't want to face new obscure bugs...).

                                     

                                    I remember anther strange behavior : SN8200 seems to react much better when the SPI frequency is high... I have also tried like you to lower SPI frequency to easy analyze at the beginning, and found out that strange behavior appeared... I am actually running my SPI at 5.25MHz.

                                     

                                    I hope this info will help you, and that we can exchange on our works as it is similar, maybe we can help each other...