View previous topic :: View next topic |
Author |
Message |
lejma Guest
|
ENC28J60 |
Posted: Sun Nov 15, 2009 4:03 am |
|
|
Hi. I've got problem with using ENC28J60. The problem is.. I don't have a idea how to use ENC28J60 driver included in CCS.
And what's more the register addresses are different in this driver and in datasheet.
In datasheet control registers are in 4 groups and every group is from 0x00 to 0x1F... in driver we have one group from 0x00 to some 0x75 (or higher value - don't remember).
For example ECOCON register is (in datasheet) in address 0x17 in group 4. In driver ECOCON is in address 0x75.
How this works? |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sun Nov 15, 2009 11:22 am |
|
|
Get the TCP/IP source from CCS. (you have to request it).
The ENC28j60 code for that works as I've been able to use it.
I did a quick compare and yes, they are very different.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Nov 15, 2009 3:59 pm |
|
|
Quote: |
For example ECOCON register is (in datasheet) in address 0x17 in
group 4. In driver ECOCON is in address 0x75. How this works?
|
That's because CCS combines the bank address with the register address
into one byte (0x75). It's easier for them to do it that way.
Look at this routine in the ENC24J60.c driver file:
Quote: | enc_mac_control_reg_address() |
The code tests bits 5 and 6 (which are the bank address) and writes
them to the ECON1 register. It then masks down the address so it
only contains bits 0-4, which is the ECOCON register address (0x1F). |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sun Nov 15, 2009 4:16 pm |
|
|
Yea, I thought they might be doing something like that but didn't have time to dig so deep.
I did a quick compare.
I suppose if you're playing with the 28J60, you probably (although not necessarily) was TCPIP... so why not just get the whole stack.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
lejma Guest
|
|
Posted: Mon Nov 16, 2009 3:37 am |
|
|
i need to make UDP transmission : ) |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Nov 16, 2009 3:55 am |
|
|
Yes, UDP is also supported by the CCS stack. |
|
|
lejma Guest
|
|
Posted: Mon Nov 16, 2009 4:32 am |
|
|
Ok. So... I need to transmit few 'integer' values in one UDP packet from PIC to PC.
Can anyone tell me what I need to 'include' and how to us it (if there is any 'already maked' driver).
For example in pic I've got :
a=10
b=30
c=20
and I need to transmit this values to PC. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Mon Nov 16, 2009 1:07 pm |
|
|
Ok. Before I dive into a long lengthy discussion, I need to know first how familiar you are with Ethernet and TCPIP.
How much information do you have already towards the making of this project?
This will help me gauge how much rambling I need to do.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Guest
|
|
Posted: Tue Nov 17, 2009 5:27 am |
|
|
I'm familiar only with basic using of SPI...
and now I'm in the middle of reading ENC28J60 datasheet.
Suggestions ? :] |
|
|
lejma Guest
|
|
Posted: Tue Nov 17, 2009 5:55 am |
|
|
I know only that ENC28J60 is communicating with PIC via SPI.
I know that I need to make a packet from variables I want to transmit
and on PC I need to make variables from packet.
But I don't know how to configure IP /netmask .. etc. for ENC28J60
and how to make and send this packet in to LAN as UDP packet. |
|
|
lejma Guest
|
|
Posted: Tue Nov 17, 2009 11:26 am |
|
|
Can anybody hlp me ? ;/ |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Tue Nov 17, 2009 12:07 pm |
|
|
Ok, so you need to get a book on the OSI protocol stack model.
I can get you some ISBN book numbers if you wish.
You need to ask this: Do you need UDP over IP or can plain ethernet work ok for you?
Ethernet takes away the extra layer of IP if you don't need it.
There is a nice UDP/IP example included with the CCS TCP/IP Stack. You should probably still request that.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Guest
|
|
Posted: Sun Dec 06, 2009 5:21 am |
|
|
I need to transmit a char string[16] over the ethernet from PIC to PC by using this damn ENC and I still don't know how to do it. :((
Any help will be nice. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sun Dec 06, 2009 12:36 pm |
|
|
Anonymous wrote: | I need to transmit a char string[16] over the ethernet from PIC to PC by using this damn ENC and I still don't know how to do it. :((
Any help will be nice. |
Well, did you ask CCS for their TCP/IP stack?
What knowledge do you have so far? At what point are you stuck?
You've described nothing of your current environment (least the mandatory PIC Compiler version and PIC)
We can't help you with just an "I'm stuck".
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
RE |
Posted: Mon Dec 07, 2009 10:54 pm |
|
|
Just curious ...why ethernet ?? why not RS 232 ?? |
|
|
|