View previous topic :: View next topic |
Author |
Message |
jakub.jnm
Joined: 26 Mar 2013 Posts: 20
|
Posted: Tue Mar 26, 2013 10:05 am Post subject: Atmega32 and Wiznet W5100 |
|
|
Hi there!
I am trying to run Wiznet W5100 with Atmega32. I connected SCK, MISO,MOSI,SS,INT pins.
I tried all sample codes, but there is still the same problem. During the compilation i obtained this message:
-Library file not found C:Program Files....\Bascom-AVR\LIB\TCPIP-W5100.LIB
I tried to find this library on the internet but i was unsuccessful.
Also tried many examples code from there, but there is the same problem.
Can anybody help me? |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Mar 26, 2013 10:18 am Post subject: |
|
|
can you post the sample you used?
the lbx should be used, not the lib. _________________ Mark |
|
Back to top |
|
|
jakub.jnm
Joined: 26 Mar 2013 Posts: 20
|
Posted: Tue Mar 26, 2013 10:43 am Post subject: |
|
|
albertsm wrote: | can you post the sample you used?
the lbx should be used, not the lib. |
Code: | $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 |
It's sample which is there on forum |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Mar 26, 2013 10:48 am Post subject: |
|
|
please compile the sample and attach a ZIP file with the rpt, err and bas files.
the problem you have is not possible with the shown sample. _________________ Mark |
|
Back to top |
|
|
jakub.jnm
Joined: 26 Mar 2013 Posts: 20
|
Posted: Tue Mar 26, 2013 10:57 am Post subject: |
|
|
albertsm wrote: | please compile the sample and attach a ZIP file with the rpt, err and bas files.
the problem you have is not possible with the shown sample. |
Ok, here is it |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Mar 26, 2013 11:01 am Post subject: |
|
|
you forgot to include the rpt file. _________________ Mark |
|
Back to top |
|
|
jakub.jnm
Joined: 26 Mar 2013 Posts: 20
|
Posted: Tue Mar 26, 2013 11:27 am Post subject: |
|
|
albertsm wrote: | you forgot to include the rpt file. |
I can't find the file.
In options -> output i have set Error file. But in folder were is program saved is no file with this suffix. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Mar 26, 2013 11:43 am Post subject: |
|
|
you need to enable report files : options, compiler, output _________________ Mark |
|
Back to top |
|
|
jakub.jnm
Joined: 26 Mar 2013 Posts: 20
|
Posted: Tue Mar 26, 2013 11:57 am Post subject: |
|
|
albertsm wrote: | you need to enable report files : options, compiler, output |
Ok, i did it. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Mar 26, 2013 1:12 pm Post subject: |
|
|
still no rpt. i have no more time, sorry. _________________ Mark |
|
Back to top |
|
|
jakub.jnm
Joined: 26 Mar 2013 Posts: 20
|
Posted: Tue Mar 26, 2013 1:47 pm Post subject: |
|
|
albertsm wrote: | still no rpt. i have no more time, sorry. |
but there is no file with this suffix!
I have selected in output all options, but after compile there is no file with this suffix.
So i tried compile another file with wrongs and there was rpt file.
If i compile this code the rpt file wasn't create.
I don't know what to do.[/img] |
|
Back to top |
|
|
jakub.jnm
Joined: 26 Mar 2013 Posts: 20
|
Posted: Tue Mar 26, 2013 3:00 pm Post subject: |
|
|
albertsm wrote: | still no rpt. i have no more time, sorry. |
Please!! Have you any suggets? |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Mar 26, 2013 3:07 pm Post subject: |
|
|
how about the version you use? _________________ Mark |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Tue Mar 26, 2013 8:38 pm Post subject: Atmega32 - Atmega8? |
|
|
In the text you are talking about a atmega32. In the code you put in this forum and in the rar-files an atmega8 is used.
Could that be the problem?
When you got your hardware finished and programmed, the first test could be a PING to the IP-address.
Have fun
Ben Zijlstra |
|
Back to top |
|
|
jakub.jnm
Joined: 26 Mar 2013 Posts: 20
|
Posted: Thu Mar 28, 2013 8:45 am Post subject: Re: Atmega32 - Atmega8? |
|
|
bzijlstra wrote: | In the text you are talking about a atmega32. In the code you put in this forum and in the rar-files an atmega8 is used.
Could that be the problem?
When you got your hardware finished and programmed, the first test could be a PING to the IP-address.
Have fun
Ben Zijlstra |
Ok i have new code from examples of Bascom.
Here is it:
Code: | '-----------------------------------------------------------------------------------------
'name : tcpip.bas
'copyright : (c) 1995-2005, MCS Electronics
'purpose : demo: CONFIG TCPIP
'micro : Mega162
'suited for demo : yes
'commercial addon needed : only hardware
'-----------------------------------------------------------------------------------------
$regfile = "m32def.dat"
$crystal = 16000000
Const Sock_stream = $01 ' Tcp
Const Sock_dgram = $02 ' Udp
Const Sock_ipl_raw = $03 ' Ip Layer Raw Sock
Const Sock_macl_raw = $04 ' Mac Layer Raw Sock
Const Sel_control = 0 ' Confirm Socket Status
Const Sel_send = 1 ' Confirm Tx Free Buffer Size
Const Sel_recv = 2 ' Confirm Rx Data Size
'socket status
Const Sock_closed = $00 ' Status Of Connection Closed
Const Sock_arp = $01 ' Status Of Arp
Const Sock_listen = $02 ' Status Of Waiting For Tcp Connection Setup
Const Sock_synsent = $03 ' Status Of Setting Up Tcp Connection
Const Sock_synsent_ack = $04 ' Status Of Setting Up Tcp Connection
Const Sock_synrecv = $05 ' Status Of Setting Up Tcp Connection
Const Sock_established = $06 ' Status Of Tcp Connection Established
Const Sock_close_wait = $07 ' Status Of Closing Tcp Connection
Const Sock_last_ack = $08 ' Status Of Closing Tcp Connection
Const Sock_fin_wait1 = $09 ' Status Of Closing Tcp Connection
Const Sock_fin_wait2 = $0a ' Status Of Closing Tcp Connection
Const Sock_closing = $0b ' Status Of Closing Tcp Connection
Const Sock_time_wait = $0c ' Status Of Closing Tcp Connection
Const Sock_reset = $0d ' Status Of Closing Tcp Connection
Const Sock_init = $0e ' Status Of Socket Initialization
Const Sock_udp = $0f ' Status Of Udp
Const Sock_raw = $10 ' Status of IP RAW
Const Epr = 1
Print "Init , set IP to 192.168.0.8" ' display a message
Enable Interrupts ' before we use config tcpip , we need to enable the interrupts
Config Tcpip = Int0 , Mac = 12.128.12.34.56.78 , Ip = 192.168.0.8 , Submask = 255.255.255.0 , Gateway = 0.0.0.0 , Localport = 1000 , Tx = $55 , Rx = $55
Print "Init Done"
'Use the line below if you have a gate way
'Config Tcpip = Int0 , Mac = 12.128.12.34.56.78 , Ip = 192.168.0.8 , Submask = 255.255.255.0 , Gateway = 192.168.0.1 , Localport = 1000 , Tx = $55 , Rx = $55
'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.6)
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 |
But if i load it into chip, terminal didn't write "Init Done".
ooh :/
I don't know what to do.
I have connected SC,MOSI,MISO before datasheet of Wiznet W5100 and ATMEGA32.
Any suggests? |
|
Back to top |
|
|
|
|
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
|
|