View previous topic :: View next topic |
Author |
Message |
DJ7DA
Joined: 03 May 2006 Posts: 83 Location: Bavaria
|
Posted: Sat Nov 24, 2012 4:25 pm Post subject: W5100 |
|
|
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 |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5922 Location: Holland
|
Posted: Sat Nov 24, 2012 11:39 pm Post subject: |
|
|
and you can also use/try NOINT option. _________________ Mark |
|
Back to top |
|
|
DJ7DA
Joined: 03 May 2006 Posts: 83 Location: Bavaria
|
Posted: Mon Nov 26, 2012 6:49 pm Post subject: |
|
|
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 |
|
|
DJ7DA
Joined: 03 May 2006 Posts: 83 Location: Bavaria
|
Posted: Fri Nov 30, 2012 4:44 pm Post subject: |
|
|
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 |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5922 Location: Holland
|
Posted: Fri Nov 30, 2012 9:10 pm Post subject: |
|
|
no the pins are 5V tolerant. So that is no problem.
Do you still have problems? _________________ Mark |
|
Back to top |
|
|
DJ7DA
Joined: 03 May 2006 Posts: 83 Location: Bavaria
|
Posted: Fri Nov 30, 2012 10:33 pm Post subject: |
|
|
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 |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5922 Location: Holland
|
Posted: Fri Nov 30, 2012 10:49 pm Post subject: |
|
|
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 |
|
|
DJ7DA
Joined: 03 May 2006 Posts: 83 Location: Bavaria
|
Posted: Fri Nov 30, 2012 11:19 pm Post subject: |
|
|
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 |
|
|
DJ7DA
Joined: 03 May 2006 Posts: 83 Location: Bavaria
|
Posted: Sat Dec 01, 2012 12:15 am Post subject: |
|
|
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 |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5922 Location: Holland
|
Posted: Sat Dec 01, 2012 11:05 am Post subject: |
|
|
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 |
|
|
DJ7DA
Joined: 03 May 2006 Posts: 83 Location: Bavaria
|
Posted: Sat Dec 01, 2012 1:25 pm Post subject: |
|
|
Mark, thanks for these sensible suggestions and hints.
I'll follow your advice.
Regards, Ernst |
|
Back to top |
|
|
DJ7DA
Joined: 03 May 2006 Posts: 83 Location: Bavaria
|
Posted: Sat Dec 01, 2012 2:01 pm Post subject: |
|
|
It works !
Resetting before Config TCPIP did it.
Thank you for your patience Mark.
Regards, Ernst |
|
Back to top |
|
|
|