Use SPI to comunicate between STM32 nucléo and WizFi250


#1

Hello,

I’m trying to comunicate with Wizfi250 module thanks to STM32 SPI bus.

For the moment, I’m just trying to send AT commands and receive [OK]. Instead of [OK], the module always return “myATcommand”[ERROR:INVALID INPUT]. I tried with command “AT\r”, “AT+MECHO=0\r”, …


How do I transfer my command :

cs = 0
wait 10us
send "AT\r"
send 0 as long as I didn’t receive the response from Wizfi250
wait 10us
cs = 1

Please, could someone help me ? I have read all the other topics talking about SPI in this forum but it didn’t help me.

Another question : I know the GPIO14 (SPI_DATA_READY) is low when Wizfi250 have a data to transmit. But does it concern only datas from external module or also for a At command response like [OK] ?

Thanks for your help


#2

Hi

please check your registered e-mail. i had sent the SPI GUIDE of WizFi250 via e-mail.

you can refer to the spi guide. and check the SPI data handling…

MCU can receive the SPI data from WizFi250 when the MCU sent 0xF0(SPI NULL) instead of 0(you sent)


#3

Hello,

Thank you for your answer and the datasheet. i tried to modify my code thanks to this but there is still something i don’t understand.

My first is only send “AT\r” command and receive "[OK] from Wizfi250. So :

  • I configure my SPI with CPOL = 0 and CPHA = 0
  • I configure my clock < 562 kHz like specified in your datasheet (353 kHz)
  • i configure SPi with 8 bit

Then I start the communication :

-cs = 0

  • wait 10us
  • send 0xF0
  • wait 10us
    -cs = 1
  • wait 10us

-cs = 0

  • wait 10us
  • send A
  • wait 10us
    -cs = 1
  • wait 10us

-cs = 0

  • wait 10us
  • send T
  • wait 10us
    -cs = 1
  • wait 10us

-cs = 0

  • wait 10us

  • send \r

  • wait 10us
    -cs = 1

  • I check “SPI_DATA_READY” signal

  • when SPI_DATA_READY is High I send 0xF0 while SPI_DATA_READY is high to read datas from Wizfi250.

But during this period i receive only 0xF0 and \n. So still not the famous [OK].

So there is something I’m not doing correctly or forgetting. Please could you correct my instruction sequence described above.

Maybe there is something I am forgetting because I don’t use the control code like SPI_ESCAPE, SPI_XON, SPI_XOFF, … but I don’t understand their signification and when they should be used.

Thanks for your help


#4

Hi

please refer to the following link.

github.com/Wiznet/Arduino_WizFi250

Arduino library of WizFi250 is used SPI interface. you can refer “wizspi_byte”, “process_esc_code”, “spi_senddata” functions in “WizFi250_spi_drv.cpp” and so on.

Thanks.


#5

Hi
I’m trying to send AT commands through stm32f4 board to wizfi250 like AT, AT+WSCAN, but it is not responding clearly.
It is sending 1 or 2 characters like A or AT and stopping to send clear response like “[ok]