Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

W5100

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

Bascom Member



Joined: 03 May 2006
Posts: 83
Location: Bavaria

germany.gif
PostPosted: Sat Nov 24, 2012 4:25 pm    Post subject: W5100 Reply with quote

I'm using the Wiznet 810MJ module together with the adapter board TCPADB-5100 and Bascom 2.0.7.5
The board is connected to a Mega8 following the TCPADB documentation. However, even the following most simple program does'nt work. Since I cannot rule out a HW problem, I would like to show my code just to make sure there isn't anything wrong with that.

'-----------------------------------------------------------------------------------------
' Server_5100_x.bas 24.11.2012
'-----------------------------------------------------------------------------------------
$regfile = "m8def.dat" '
$crystal = 8000000 '
$baud = 9600 '

$hwstack = 64
$swstack = 64
$framesize = 64

Config Spi = Hard , Interrupt = On , Data Order = Msb , Master = Yes , Polarity = Low , _
Phase = 0 , Clockrate = 4 , Noss = 0
Spiinit

Enable Interrupts
Config Tcpip = Int0 , Mac = 12.128.12.34.56.78 , Ip = 192.168.2.16 , Submask = 255.255.255.0 , _
Gateway = 192.168.2.1 , Localport = 5000 , Tx = $55 , Rx = $55 , Chip = W5100 , Spi = 1

Dim Bclient As Byte ' socket number
Dim Idx As Byte
Idx = 0 ' only 1 socket

Dim Result As Word

Config Portc = Output ' for status indicator
Dim Status As Byte
Dim Status_old As Byte

'----------------- init ----------------------------------
Osccal = &H90
'----------------- Main ----------------------------------

Wait 1 ' nur 1 Socket
Print "Starting...."

Do
Waitms 200
Result = Socketstat(idx , 0) ' get status
Status = Result
If Status <> Status_old Then
Portc = Not Status
Print "Status: " ; Status
Status_old = Status
End If
Select Case Result
Case Sock_established
Print "Connected"
Case Sock_close_wait
Closesocket Idx
Case Sock_closed
Bclient = Getsocket(idx , Sock_stream , 5000 , 0) ' get socket for server mode
Socketlisten Idx
Case Sock_listen
nop
Case Else
Closesocket Idx
End Select
Loop

End

I never reach the Print "Starting..." line, with or without the Do...Loop.

Any help or hint is appreciated.
Thanks
Ernst
[/code]
Back to top
View user's profile
bzijlstra

Bascom Ambassador



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

netherlands.gif
PostPosted: Sat Nov 24, 2012 7:18 pm    Post subject: CS missing... Reply with quote

http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&p=54452#54452

Check this, I am missing the CS in the config tcpip command in your code.

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

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Sat Nov 24, 2012 11:39 pm    Post subject: Reply with quote

and you can also use/try NOINT option.
_________________
Mark
Back to top
View user's profile Visit poster's website
DJ7DA

Bascom Member



Joined: 03 May 2006
Posts: 83
Location: Bavaria

germany.gif
PostPosted: Mon Nov 26, 2012 6:49 pm    Post subject: Reply with quote

The problems are gone.
The Mega8 used in my project was sitting on my (good old) STK200 board.
As a last resort I put it on a different board (the one from Pollin in Germany).
There everything works according to the book as well as my expectations.

Seemingly the SPI signals are the source of the problem since my TWI based TCPIP works
without a flaw on the STK200.

Thanks to all readers and contributors.

Regars
Ernst
Back to top
View user's profile
DJ7DA

Bascom Member



Joined: 03 May 2006
Posts: 83
Location: Bavaria

germany.gif
PostPosted: Fri Nov 30, 2012 4:44 pm    Post subject: Reply with quote

It just occurred to me:
The TCPADB-5100 board is running at 3,3 V. My Mega8 controlling the board via SPI runs at 5 V.
Could that be the cause of the problems I was encountering?
Regards, Ernst
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Fri Nov 30, 2012 9:10 pm    Post subject: Reply with quote

no the pins are 5V tolerant. So that is no problem.
Do you still have problems?

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

Bascom Member



Joined: 03 May 2006
Posts: 83
Location: Bavaria

germany.gif
PostPosted: Fri Nov 30, 2012 10:33 pm    Post subject: Reply with quote

Glad to hear that Mark, thank you.
It now does what it is supposed to do. The only flaw still existing is that the whole thing needs a reset after power-on to start working. Right after loading a new program it starts all by itself, however, not after a pure powering up.
I need to investigate that. Meanwhile I was thinking about a temporary fix for this mishehaviour - couldn't find out though how to apply one (and only one) watchdog reset right after power-on.
Well, there is weekend ahead...
Regards
Ernst
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Fri Nov 30, 2012 10:49 pm    Post subject: Reply with quote

yes it needs a hard reset. i noticed that too. I use a processor pin for that. You will find that in one of the samples.
_________________
Mark
Back to top
View user's profile Visit poster's website
DJ7DA

Bascom Member



Joined: 03 May 2006
Posts: 83
Location: Bavaria

germany.gif
PostPosted: Fri Nov 30, 2012 11:19 pm    Post subject: Reply with quote

I'm glad that I am not the only one to see the need for a hard reset.
I couldn't find anything in the samples though. Earlier today I already used a processor pin to pull the /RST low for a few ms right after the initialization but was not successful. I'll keep on trying.
Thanks Mark
Regards, Ernst
Back to top
View user's profile
DJ7DA

Bascom Member



Joined: 03 May 2006
Posts: 83
Location: Bavaria

germany.gif
PostPosted: Sat Dec 01, 2012 12:15 am    Post subject: Reply with quote

Just tried it again Mark. PORTD.6 as output and /RST attached to it. Then

PORTD.6 = 0
Waitms 10
PORTD.6 = 1

No effect.
Could it be that VoL of the Mega8 pin isn't low enough to reach the VoL of the WIZ810MJ ?

Good night Mark
Ernst
Back to top
View user's profile
bzijlstra

Bascom Ambassador



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

netherlands.gif
PostPosted: Sat Dec 01, 2012 10:58 am    Post subject: Reset on Wiz810MJ / W5100 Reply with quote

Have also noticed the reset problem. I think it is mentioned on this page
http://members.home.nl/bzijlstra/software/examples/wiz810mj.htm

But with a extra pin you can reset the module by yourself.

Here a link to the schematics of the board I use
http://members.home.nl/hobbycorner/images/redbokito.jpg

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

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Sat Dec 01, 2012 11:05 am    Post subject: Reply with quote

first test the voltage level of this pin.
then increase the time from 10 ms to 100 ms
I looked at my code but i could not find it. i usually use the mcs bootloader with DTR that serves as reset and that works.
but i had this same problem and it wend away after i used a pin to reset the chip. you need to do this before the config tcpip.
Later i used various boards and setups and this manual reset was not needed any longer.

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

Bascom Member



Joined: 03 May 2006
Posts: 83
Location: Bavaria

germany.gif
PostPosted: Sat Dec 01, 2012 1:25 pm    Post subject: Reply with quote

Mark, thanks for these sensible suggestions and hints.
I'll follow your advice.
Regards, Ernst
Back to top
View user's profile
DJ7DA

Bascom Member



Joined: 03 May 2006
Posts: 83
Location: Bavaria

germany.gif
PostPosted: Sat Dec 01, 2012 2:01 pm    Post subject: Reply with quote

It works !
Resetting before Config TCPIP did it.
Thank you for your patience Mark.
Regards, Ernst
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