WIZnet Developer Forum

SPI connections

Hello,

I need to connect wizfi250 to an MCU. Please give me some help!

  1. In other posts and datasheets you mention about GPIO pin 14 that you use it to see if wifzi has data to send. Yes, but what would be the status of the pin when data is ready? Low or high?

  2. What is the maximum and what the minimum MASTER MCU clock speed that wizfi250 cav handle?

  3. By saying that there is an SPI_Data Ready Pin, then there must be a register on Wizfi250 that stores that byte.
    Is that register accessible?
    How many bytes can it store?
    How long is the data stored?

  4. Regarding the setting of SPI.
    When I connect the USB cable in order to set communcation as SPI , I send the command AT+MSPI=? and I get AT+MSPI=1,0, which means UART interface.
    Then I send AT+MSPI=2,0 in order to set interface as SPI and I get response "ok"
    Then I send again AT+MSPI=? and I get response AT+MSPI=1,0, which means UART >> my question is how do I set up as SPI interface and keep it that way without being revert back to UART?

  5. What is the minumum/ maximum voltage for SPI pins?

  6. When I connect the SPI pins to the MCU and then I disconnect the Ground of the Wizfi supply BUT leave the 5V then the LED1 is ON! Does this mean that back current comes from the SPI pins? Is this harmfull? Should I place diodes on the SPI connections?

I would appreciate your answer,

Thank you

Best Regards,

Andreas Achilleos

Hello Andreas Achilleos.

  1. If WizFi250 is ready to send data, It will set the HIGH of GPIO 14 pin. Then MCU has to send “0xF0”(SPI Control code).

There is a list of SPI Control Code.
#define SPI_NULL (uint8_t) 0xF0
#define SPI_ESC (uint8_t) 0xF1
#define SPI_SYNC (uint8_t) 0x02
#define SPI_XON (uint8_t) 0x03
#define SPI_XOFF (uint8_t) 0x04
#define SPI_ERR (uint8_t) 0x05

  1. WizFi250 can be set just one interface (UART, SPI).
    If you get the response “OK” from WizFi250 using SPI interface when you send AT command. WizFi250 is already set SPI interface.

  2. 3.0~3.6Voltage. typically 3.3V
    wizwiki.net/wiki/doku.php?id=pro … 50ds:start

  3. You can refer to the following reference schematic.
    wizwiki.net/wiki/doku.php?id=pro … bsch:start

Hello wizdaniel,

Thank you for your response.

Concerning question 4, I need to clarify some things first.
a . How do I set in first place the wizfi to be connected as SPI? Can I connect through air command and the send the appropriate command?
b. [quote]If you get the response “OK” from WizFi250 using SPI interface when you send AT command. WizFi250 is already set SPI interface.[/quote]
as far as I know I cannot send AT commands normally through wifi, so how will I get an “ok” response from wizfi? Or if you mean to connect via air command mode and then send AT+MSPI=2,0?

Concerning question 1 , I have measured the GPIO 14 pin and always is HIGH! Can you commend that please?
As I can see the GPIO pin 14 is the one located at the GPIO jumper?

Thank you,

Best Regards,

Andreas Achilleos

Hello Wizdaniel

You have mentioned some HEX codes for controlling the SPI.

[quote]There is a list of SPI Control Code.
#define SPI_NULL (uint8_t) 0xF0
#define SPI_ESC (uint8_t) 0xF1
#define SPI_SYNC (uint8_t) 0x02
#define SPI_XON (uint8_t) 0x03
#define SPI_XOFF (uint8_t) 0x04
#define SPI_ERR (uint8_t) 0x05[/quote]

Do you have any datasheet for that?

Is there a description of what every command does?

AND more important, can you send me a typical command sequence of instructions to use in order to establish spi connection to MCU?

Thank you,

Best Regards,

Andreas Achilleos

Hi Andreas Achilleos

OK response.
“OK” is a normal response about some AT command. Just example.
cmd: AT
resp: [OK]

About switching SPI mode
What is the F/W version of your WizFi250. I prefer you to upgrade the firmware above 1.0.4.2
wizwiki.net/wiki/doku.php?id=pro … ware:start

SPI data Ready
GPIO 14 pin will be set the HIGH when data is ready to send.

Data will be saved in ringbuffer(2048byte).

Other SPI HEX code
WizFi250 can communicate with the Arduino. So you can refer to the library source of WizFi250 for Arduino.
github.com/Wiznet/Arduino_WizFi250

Thanks.

Hello,

Sorry to bother again but this cannot help me at all.

As I can see no datasheet and no instruction are available for communicating with Wizfi250 via SPI. You have sent me a link about some arduino files that I do not understand them! I am trying to connect a PIC 16F877A and NOT an arduino.

You are saying about spi registers and spi command that I should use to establish the communication but every time you are saying about something new, I really need to get on my hands a guide written from the manufacturers of the wizfi250. I need to know all the procedure and registers.

As I understand I can send AT commands through USB cable and connect the computer - i.e UART, with SPI how do I send AT commands adn receive a response?

[quote]>> SPI data Ready
GPIO 14 pin will be set the HIGH when data is ready to send.

Data will be saved in ringbuffer(2048byte).[/quote]

How do I access the ringbuffer? I mean what is the address of it?
If I need to send data to wizfi 250 will I need to write to a buffer on it? If yes then what is the address of it?

Any better clarification will be greatly appreciated!

Thank you,

Best Regards,

Andreas Achilleos

Hi.

We do not provide a detailed source code. We will just provide a guide for control methods.
You have to use AT command to control the WizFi250 via SPI or UART.

Data will be saved in ringbuffer(2048byte).
I said it because of some of your questions like “How long is the data stored?”, "How many bytes can it store?"
It means that WizFi250 can store the data until the ringbuffer is full.

Thanks.

Hello,

[quote]We do not provide a detailed source code. We will just provide a guide for control methods.
You have to use AT command to control the WizFi250 via SPI or UART.[/quote]

  1. With UART I can communicate through USB cable and computer in order to send AT commands.
    Can I use SPI to send data (not AT commands) to the wizfi through wifi from a mobile phone?
    If yes, then will I just send the data from the mobile phone and the wizfi will transmit it through SPI to the MCU OR will I have to use the MCU to access a register on wizfi via SPI read command to access the received DATA from the mobile phone?
    If I have to access a register in order to get that data then; I will have to know what is the address of that register.

2 . Is SPI only for AT commands?

Thank you,

Best Regards

HI Andreas Achilleos.

The role of AT commands is to set up the status of WizFi250.
After setting(connect other terminal [ex: your mobile phone] using AT command set.), you can send the data through SPI(MISO).

If WizFi250 receive the data from another terminal. Data_ready_pin(GPIO14) will set HIGH. then, you just have to read MOSI pin.
There is no need to access a register.

Thanks.

Best Regards

daniel.

Hello Daniel,

I appreciate your response, it helps a lot!

Best Regards,

Andreas Achilleos

Hello Daniel,

You said: [quote]If WizFi250 receive the data from another terminal. Data_ready_pin(GPIO14) will set HIGH. then, you just have to read MOSI pin.[/quote]

So that means that wizfi will be set as MASTER? Or you mean I should read the MISO? Master In Slave Out

I have set the wizfi to communicate as SPI BUT even when I have android phone connected with it AND i SENT NO DATA the GPIO14 is always pulled high 3.2V do you know why? Is this supposed to be like that? I thought that only when data are available is pulled high

Thank you ,

Best Regards,

Andreas Achilleos

Hi,

WizFi250 is a slave. you have to connect SPI pin(Clock, Sel, MOSI, MISO) and Data ready pin(WizFi250 GPIO14)
in case of SPI, the Master can select a slave and send to them, but, when a Slave wants to send data to Master?
for that situation, WizFi250 set the Data ready pin to High for notification that slave(WizFi250) has a data to Master.

Master(MCU) can check that slave has a data for sending to Master.

Hello,

Thanks for the reply.

I understand but when GPIO 14 is set high, which pin I must read from wizfi? MISO or MOSI?

Thank you,

Best Regards

Hello Daniel,

I have upgraded the wizfi to 1.0.4.2, I have managed to send data through SPI to MCU but ll characters I get are making no sense, as if are a different language all random AND wizfi does NOT stop sending these characters! edited I have changed a little bit the SPI setting of the MCU and I get character such as “wfi5” brackets “[]” and some number like IP address. I assume that the “wfi5” must be Wizfi250 as I know; that when wizfi makes a connection sends such data. So it must be that the data are not properly being send! Any idea?

Also when I send data from MCU, numbers and characters to wizfi all I get on my android device are dots! Any idea on that?

The most important is that I try now to connect the wizfi through usb cable on my PC and it cannot be connected. Putty does not recognize it neither does the firmware upgrade via boot mode. I have press the function key for more than 3.5 sec in order for the wizfi to be reset so that it will accept serial communication instead of spi but still nothing, wizfi cannot be connected to PC. However when I connect Putty, 115200 baud it does not establish a link but with every key I press on the keyboard the LED2 on wizfi flashes!
edited i have found a solution regarding the usb to PC connection, the wizfi was accepting data from putyy but putty was not showing them on screen so I just typed “in blind” and managed to set wizfi to be set as UARt, might this be a bug?

Any ideas?

Thank you,

Best Regards,

Andreas Achilleos

Hello,

I have connected the wizfi with MCU ad android device. The MCU reads 16 bytes from SPI and then puts it in an array of data and outputs it on display.
When I power up the MCU and wizfi the MCU displays on screen “successful connected” then a lot of Chinese characters then I get the SSID name and some ip address, then a lot of random characters and this is going on for about 250 bytes or so and after that finishes the GPIO14 is 0V.

If I connect the android device and send data the GPIO14 is set 3.2v then I read from MCU and I do not get all characters, for example I send “4444444” from android and at the MCU I get this : " Chinese character, 4, Chinese character, 4 , Chinese character, Chinese character, 4 "
Have any idea about that?

I have set the options at MCU, clock idle low,transmit on falling edge, Input sampled at end of data output time.

The even if the GPIO14 is 0v, if I receive SPI byte from wizfi almost always I get Chinese characters or a lot of “xxxxxxxxxxxxxxxxx” or “zzzzzzzzzz” or “pppppppp”

Also sent data from MCU are arriving at android as dots…

Any ideas?

Thank you,

Best Regards,

Andreas Achilleos

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