Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

WizFi210 - Serial to WiFi

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM Project Blog
View previous topic :: View next topic  
Author Message
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sat Dec 22, 2012 9:10 am    Post subject: WizFi210 - Serial to WiFi Reply with quote

A blog with some information about the Wiznet WizFi210 module on an Arduino Mega.

Here a picture of the hardware, a WizFi210 on an Arduino Mega shield. You will have to build your own, but all info here.




Ben Zijlstra
Theo Kleijn

---

Xmas project 2012 - to be continued
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sat Dec 22, 2012 9:31 am    Post subject: WizFi210 - Serial to WiFi - hardware Reply with quote

The hardware design:



WizFi210 with hardware-trigger switch S4, for updating the firmware of the WizFi210, and two buttons and three LED's.





The power part of the board. With a LT1528 power-regulator, with a power-off mode triggered by PWR-OFF





Four level converters for TXD, RXD, RTS and CTS.


Ben Zijlstra
Theo Kleijn

---

Xmas project 2012 - to be continued
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sat Dec 22, 2012 9:41 am    Post subject: WizFi210 - Serial to WiFi - additional hardware Reply with quote

Additional hardware:

To update the firmware to the latest version and to make an initial profile to connect to an WiFi access point, you need a temporarely RS232 level converter.





Temporarely bending two pins on the Arduino Mega shield.


Ben Zijlstra
Theo Kleijn

---

Xmas project 2012 - to be continued
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sat Dec 22, 2012 9:51 am    Post subject: WizFi210 - Serial to WiFi - hardware during test phase Reply with quote

Some pictures of the Arduino Mega shield during a test phase:



The shield without the WizFi210 module




The board with the WizFi210 temporarely connected, just to test




Test phase. In front the WizFi210-evaluation board from Wiznet.


Ben Zijlstra
Theo Kleijn

---

Xmas project 2012 - to be continued
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sat Dec 22, 2012 10:11 am    Post subject: Serial to WiFi - WIZSmartScript Reply with quote

To put the latest firmware in the WizFi210 module and create a profile to connect to an WiFi Access point you have to download the WIZSmartScript from the Wiznet site



The ZIP-file extracted




Start the WIZSmartScript program, baudrate 115200




Find WizFI and Set Command Mode




Do an Access Point scan and select the Access Point to associate with




Select the WiFi security. In this case WPA with the Passphrase 'wisclub1'




Give the module a static IP address (or if you want, give it a DHCP IP address)




Here you can change the Serial port options




For this example we will be using UDP traffic to a PC in our network that has the IP address 192.168.0.237 listening to port 5000




Select an save option. Here you create an startup profile for the WizFi210 module.
You enable auto connect on the next reboot and enable UART messages.




Save the script for later use.




We saved it with the name benshobbycorner and here an example of a script.


Ben Zijlstra
Theo Kleijn

---

Xmas project 2012 - to be continued
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sat Dec 22, 2012 10:29 am    Post subject: Serial to WiFi - Bascom-AVR code and output Reply with quote

Remove the temporarely RS232 level converter and bend the two pins of the Arduino Mega shield back.
The two pins are connected to INT0 / INT1 of the Atmega1280 and thanks to SIX1, we got a program from a earlier project with the WIZ610wi wireless module with some nice serial routines.

Code:
'Arduino Mega 1280 - WIZFI210

$regfile = "m1280def.dat"
$crystal = 16000000
$baud = 115200

$hwstack = 80
$swstack = 80
$framesize = 90

Poweroff Alias Portj.1

Config Poweroff = Output

Dim Connect As Byte

'put power on the shield

Set Poweroff
Wait 5
Reset Poweroff

'PD.0 = TX
  Open "comd.0:115200,8,n,1" For Output As #10
'PD.1 = RX
  Open "comd.1:115200,8,n,1" For Input As #11

'-------------------------------------------------------------------------------
' ARDUINO HARDWARE SERIAL
'-------------------------------------------------------------------------------
   Config Serialin = Buffered , Size = 60 , Bytematch = 13
   Open "com1:" For Binary As #1
   Dim Incoming_data As String * 60

   Print #1 , "Start programma"

'-------------------------------------------------------------------------------
' INT0 RX INTERRUPT
'-------------------------------------------------------------------------------
    Dim Timeout_rx As Word
    Dim Rx_ok As Byte
    On Int1 Isr_rx Nosave
    Config Int1 = Change
    Enable Int1
    Enable Interrupts

'-------------------------------------------------------------------------------
' VARIABLES
'-------------------------------------------------------------------------------
    Dim B As Byte
    Dim Pos As Byte
    Const Max_rx = 100
    Dim Incoming_str As String * 150
    Dim Incoming(max_rx) As Byte At Incoming_str Overlay

'-------------------------------------------------------------------------------
' START PROGRAM
'-------------------------------------------------------------------------------

    Print #1 , "Arduino WIZFI210"

    Do
    Connect = Instr(incoming_str , "[CONNECT 0]")
    If Connect = 3 Then
       Print #1 , "Connected"
       Exit Do
    End If
    Waitms 10
    Loop

    Do
    Wait 1
    Print #10 , "abcdefg"
    Loop


End

'-------------------------------------------------------------------------------
' send USB RX to WIZ
'-------------------------------------------------------------------------------
Serial0charmatch:
   ' send command from USB to WIZ610
   Input Incoming_data Noecho
   'Print #10 , Incoming_data
Return

'-------------------------------------------------------------------------------
' RX from WIZ on SoftSer
'-------------------------------------------------------------------------------
Isr_rx:
     Disable Int1
     Timeout_rx = 0
     Incoming_str = ""
     Pos = 1
     Do
        B = Inkey(#11)
        If B > 0 Then
           If Pos < 120 Then
             Incoming(pos) = B
             Incr Pos
           End If
           Timeout_rx = 0
        Else
          Incr Timeout_rx
        End If
     Loop Until Timeout_rx = &H1FFF
     'set string end position!
     Incoming(pos) = 0
Print #1 , Incoming_str
Print #1 , "-"
     Rx_ok = 1
    'clear INT0 Int Flag, because int can be flaged in meantime!
     Eifr.intf1 = 1
     Enable Int1
Return
 


Start Bascom-AVR terminal on 115200 baud and you should get this:



If everything is correct, you will see something on the terminal screen, and when there is an associate with an Access Point two LEDs are on on the WiFi210 Arduino Mega shield.




From the www.hw-group.com download their amazing Hercules program and configure it to use UDP on 192.168.0.80 port 5000 (in the picture we have used port 8888), and if everything is working you should get the abcdefg from your Arduino Mega WizFI210 shield.

Wireless UDP connection working. The third LED on the Arduino Mega WizFi210 shield will blink everytime an abcdefg is send over the network.


Ben Zijlstra
Theo Kleijn

---

Xmas project 2012 - to be continued
Back to top
View user's profile Visit poster's website
MAK3

Bascom Member



Joined: 24 Sep 2010
Posts: 449
Location: Germany

germany.gif
PostPosted: Sun Dec 23, 2012 10:29 am    Post subject: Reply with quote

Hi Ben,

as always, it is a pleasure to follow and read your projects.

MAK3
Back to top
View user's profile
six1

Bascom Expert



Joined: 27 Feb 2009
Posts: 553

germany.gif
PostPosted: Sun Dec 23, 2012 3:16 pm    Post subject: Reply with quote

Thanks Ben, for all your work, creativity and bringing up new Chips and solutions!
_________________
For technical reasons, the signature is on the back of this message.
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5916
Location: Holland

blank.gif
PostPosted: Mon Dec 24, 2012 12:09 pm    Post subject: Reply with quote

hi Ben & Theo

I see you teamed up again for another great project Very Happy
This is good reading. Thanks for the pics. It is very clear.
Few questions.
- Can you post a link to the pdf of the used module
- where can we buy this nice arduino board?
- is this wiznets own chip/module? their previous wifi modules only had their name if i remember correctly.

you guys rock, thank you for sharing. looking forward to the other posts Very Happy

_________________
Mark
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sat Dec 29, 2012 8:52 pm    Post subject: Serial to WiFi - WIZSmartScript Reply with quote

WizSmartScript seems to be a shell around the gs_flashprogram.exe

Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM Project Blog All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum