Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

uno r3 wz5100 basics

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP
View previous topic :: View next topic  
Author Message
max

Bascom Member



Joined: 29 Jun 2005
Posts: 131

australia.gif
PostPosted: Tue Apr 14, 2015 8:57 am    Post subject: uno r3 wz5100 basics Reply with quote

Hello,

After much googleing.... i am here.

I have an Arduino R3 with an ethernet board sitting on top. it has the WZ5100 chip inside.
The wiki.bascom site has a sample.

All i get are errors in the terminal and I cant ping the board on my LAN

If i program the device using the arduino loader..no problem. Can ping okay.

I know my Bascom AVR software to Arduino Uno R# works okay.

Have there been any changes since the wiki sample was written?

I have the fully paid for version of Bascom AVR

Thanks in advance
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5915
Location: Holland

blank.gif
PostPosted: Tue Apr 14, 2015 9:25 am    Post subject: Reply with quote

you can best check the tcpip samples from the samples\tcpip\w5100 folder. (File, Open Sample)
the only important thing is to chose the proper SS pin in the CONFIG TCPIP.
As i recall the wiki describes a different module.

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

Bascom Member



Joined: 29 Jun 2005
Posts: 131

australia.gif
PostPosted: Tue Apr 14, 2015 11:40 am    Post subject: [Resolved] Reply with quote

Thanks Mark.
I have checked all the information.
The SS pin is portb.2

This line works. It seems to be the interrupt function
The code below is all on one line

I changed from this
Config Tcpip = Int1 , Mac = 12.128.12.34.56.78 , Ip = 192.168.1.8 , Submask = 255.255.255.0 , Gateway = 192.168.1.1 , Localport = 1000 , Tx = $55 , Rx = $55 , Chip = W5100 , Spi = 1 ,CS=portb.2

to this
Config Tcpip = Noint , Mac = 12.128.12.34.56.78 , Ip = 192.168.1.8 , Submask = 255.255.255.0 , Gateway = 192.168.1.1 , Localport = 1000 , Tx = $55 , Rx = $55 , Chip = W5100 , Spi = 1 ', Cs = Portb.2
I can now see the device when i do a local area port scan

I changed the chip type to reflect the new ATMega chip number ATM328p
Added some stack etc

By the way, if you are wondering why I am using the Bascom rather than Arduino...other than its a better system. The arduino uses up 65% of the space just with the added libraries. I use the hardware because it is easy to get hold of without making boards etc

--------------------------
'-----------------------------------------------------------------------------------------
'name : tcpip_SPI.bas
'copyright : (c) 1995-2012, MCS Electronics
'purpose : demo: CONFIG TCPIP
'micro : Mega88''''''' changed to 328p
'suited for demo : yes
'commercial addon needed : only hardware
'-----------------------------------------------------------------------------------------

$regfile = "M328pdef.dat" ' set to suit R3 chipset
$crystal = 16000000 ' set UNO chrystal value
$baud = 19200
$hwstack = 100
$swstack = 100
$framesize = 400

Const Epr = 1

Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = LOW , Phase = 0 , Clockrate = 4 , Noss = 0
'Init the spi pins
Spiinit

Print "Init , set IP to 192.168.1.8" ' display a message
Enable Interrupts ' before we use config tcpip , we need to enable the interrupts





Config Tcpip = Noint , Mac = 12.128.12.34.56.78 , Ip = 192.168.1.8 , Submask = 255.255.255.0 , Gateway = 192.168.1.1 , Localport = 1000 , Tx = $55 , Rx = $55 , Chip = W5100 , Spi = 1 ', Cs = Portb.2

'Syntax W5100

'CONFIG TCPIP =
'int ,
'MAC = mac ,
'IP = ip,
'SUBMASK = mask,
'GATEWAY = gateway,
'LOCALPORT= port,
'TX= tx,
'RX= rx ,
'NOINIT= 0|1 [, baseaddress = address]
'[,TimeOut=tmOut] [,CHIP=5100]
' [,SPI=spi]
'[,INT=imsg]
' [,CS=cs]
'[,NOUDP=noudp]


'Config Tcpip = Int1 , Mac = 12.128.12.34.56.78 , Ip = 192.168.1.8 , Submask = 255.255.255.0 , Gateway = 192.168.1.1 , Localport = 1000 , Tx = $55 , Rx = $55 , Chip = W5100 , Spi = 1 ,CS=portb.2
Print "Init Done"

'config pinb.2 = output '''''Set SS pin used on Arduino Uno. = pin 10 SS on UNO
'set pinb.2 '''''Set to high




'The next code is optional. It shows how to change the IP at run time
#if Epr = 1
Dim Xx As Eram Long ' this is 4 bytes of EEPROM
Dim Zz As Long ' this is a long
Zz = Xx ' read eeprom
Dim B4 As Byte
B4 = 8

'use maketcp to create an IP number
'notice that last param is a variable.
'all bytes could be variables of course
Zz = Maketcp(192 , 168 , 0 , B4)

'in reverse order
Zz = Maketcp(b4 , 9 , 168 , 192 , 1)

'simplest form
Zz = Maketcp(192.168.0.Cool

Print Ip2str(zz)
Settcp 12.128.12.34.56.78 , Zz , 255.255.255.0 , 0.0.0.0
' ^ notice the variable that holds the IP address 192.168.0.8
' from the EEPROM data line below
#endif

Do
nop
' a ping should now work
Loop
End


End


$eeprom
' take care, data is stored byte, by byte so reversed notation is used
Data 8 , 0 , 168 , 192 ' this is 192 , 168 , 0 , 8
$data
Back to top
View user's profile
bzijlstra

Bascom Ambassador



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

netherlands.gif
PostPosted: Tue Apr 14, 2015 12:59 pm    Post subject: does it work? Reply with quote

Is the code working or isn't it?

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
max

Bascom Member



Joined: 29 Jun 2005
Posts: 131

australia.gif
PostPosted: Tue Apr 14, 2015 1:07 pm    Post subject: Reply with quote

Hi Ben,
The hardware is now working.

The software is out of the Bascom examples. I was trying to let people know what they need to do to get the Arduino hardware working. Mainly because software on the internet is based on OLD versions.

As for the software here, I am still playing with it. Misses a few pings and shows the time as "2" instead of the real time.

At lease the shield is talking
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1257
Location: SYDNEY

australia.gif
PostPosted: Tue Apr 14, 2015 1:12 pm    Post subject: Reply with quote

Hello max

My W5100 web server would fit onto your chip with space left over.
Have a look at it in the Project Blog section.

Regards Paul
Back to top
View user's profile
max

Bascom Member



Joined: 29 Jun 2005
Posts: 131

australia.gif
PostPosted: Tue Apr 14, 2015 1:22 pm    Post subject: Reply with quote

Hi Paul,
In my case, I dont need a web server.
I live on my boat and just wanted to send emails when inputs change. mainly if my bilge pumps are running.
Next would be a single page to activate lights etc

As I use android and apple products, FLASH is out.
I have a raspberry Pi for the web server using Apache etc

its all still early days....sadly most code on the NET and even examples are for obsolete or outdated boards
I am using Arduino boards because they are easy to get hold of in Australia

Wishlist
Anchor drag alarm using GPS
System monitoring such as water levels in my drinking water tanks'
Battery voltage
Bilge alarm status
Being able to remotely turn on my "At anchor light" etc

I did look at your web server, but it is for a different chipset. I am using the arduino UNO
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1257
Location: SYDNEY

australia.gif
PostPosted: Tue Apr 14, 2015 2:02 pm    Post subject: Reply with quote

Hello max
Its only a simple web server intended to serve pages to:
Turn things on and off
I wanted it to be as simple as pressing a button on your phone or tablet.

Send commands to rs232 port
Monitor devices
Gets NTP time
Even have working gauges but this was just to see if it could handle ajax type code.
Have not added e-mail yet
It serves pages so that it only limits to devices that can show simple HTML pages which there are many.
I tried to make the functions modular so you could just use the ones you want.
It is aimed at home automation and monitoring so it should be what you want.
Yes for doing a full web server task the Pi is good

Regards Paul
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP 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