WIZnet Developer Forum

How wizfi250 sends data-SPI

Hello,

I am connecting the wizfi250 to an MCU through SPI and when those 2 are connected the wizfi continuously sends data to the MCU for a very long time, GPIO14 is 3.2v. It stops only when I connect the android device to wizfi. Any idea why?

I have read in another topic tha in order to receive bytes from wizfi I will have to set CS 0v then read SPI, then CS 5v and do this as many times as the number of bytes are.
For example
CS pin > 0V
SPI macro > receive byte1
CS pin > 5v

CS pin > 0V
SPI macro > receive byte2
CS pin > 5v

CS pin > 0V
SPI macro > receive byte3
CS pin > 5v

But when I tried that I could not read properly the data from wizfi AND finally I managed to read them when I tried to read from wizfi with the following way:
CS pin > 0V
SPI macro > receive byte1
SPI macro > receive byte2
SPI macro > receive byte3
CS pin > 5v

Does it make any sense? Have any ideas? Which way is the correct?

Also this did not worked all the time , most of the times I was getting scrabbled data or chinese characters,

Another question , what setting should I use on the MCU, sample data at the middle of the cycle or at the end?

Best Regards,

Andreas Achilleos

Hi,

You can refer to the following code for SPI interface.

// WizFi250 SPI CONTROL CODE

#define SPI_NULL (uint8_t) 0xF0
#define SPI_ESC (uint8_t) 0xF1
#define SPI_F0 (uint8_t) 0x00
#define SPI_F1 (uint8_t) 0x01
#define SPI_SYNC (uint8_t) 0x02
#define SPI_XON (uint8_t) 0x03
#define SPI_XOFF (uint8_t) 0x04
#define SPI_ERR (uint8_t) 0x05

When you want to receive the data from WizFi250, You have to send SPI_NULL(0xF0) to WizFi250 using SPI interface like below.

CS to Low
Microseconds delay (10ms)
SPI Send NULL to WizFi250
Recive the data at the same clock that was sent SPI_NULL
Microseconds delay (10ms)
CS to High

If you want to know about it, you have to refer to the Arduino WizFi250 library.
github.com/Wiznet/Arduino_WizFi250

Thanks.

Hello

Thank you Wizdaniel for the reply.

Should not this information be listed in the start guide of wizfi250? As I saw other people also have trouble using SPI!

However You said

[quote]>> Microseconds delay [color=#FF0000]size=150[/size][/color][/quote] Which is it? Microseconds or Milliseconds?

Thank you,

Best Regards

Andreas Achilleos

Hello Wizdaniel

Just a few observations.

  1. I have managed to send data from MCU to wiznet > android , with Delay 10 microseconds and without delay

[quote]When you want to receive the data from WizFi250, You have to send SPI_NULL(0xF0) to WizFi250 using SPI interface like below.

CS to Low
Microseconds delay (10ms)
SPI Send NULL to WizFi250
Recive the data at the same clock that was sent SPI_NULL
Microseconds delay (10ms)
CS to High[/quote]

Is the delay mandatory or is only for receiving data from wizfi and not for sending?

  1. When you say to send to wizfi NULL (0xF0) what do you mean exactly? To send via SPI the byte value 240?

  2. The only way to receive data from Wizfi is to constantly reset my MCU until I rerceive character “x” from wizfi and then if I send something from Android I will receive it to my MCU.
    If I send any data to wizfi, before wizfi sends me the “x” even if GPIO is set high I do not receive any data! Any idea on that? “x” stands fro value 120 in decimal.

Thank you,

Best Regards

Andreas Achilleos

Hi

Please refer to the following link that you have written.

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.