CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to pass data(receive) to Ethernet output of 18F66J60???

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

How to pass data(receive) to Ethernet output of 18F66J60???
PostPosted: Tue Jan 03, 2012 12:20 pm     Reply with quote

I`ve checked the header but I didn`t find any functions for passing or receiving data to/from internet interface?
Should I read/write directly to the registers? if I must do so how to pass data to the communication line?
I can`t find any commands for internet!
Can someone explain this things to me!
Thanks!
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Jan 03, 2012 9:04 pm     Reply with quote

The Ethernet controller is a very low level device that handles the physical layer interface and the transmission of MAC frames between the controllers send and receive buffers and the Ethernet interface. Your application software is responsible for Driving the operation of the controller. You need a protocol stack. CCS have such a stack. It is this stack that provides the APIs to communicate via network protocols such as TCP/IP.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Wed Jan 04, 2012 8:59 am     Reply with quote

Can you give me a link to download ccs stack???
I`m using mplab v8.33, ccs v4.078
I`m trying to create my own TCP/IP stack. I`ve used some examples but there is used extra chip (Ethernet controller) connected through SPI interface.
In these case the Ethernet controller is in the chip and I don`t know how to pass/receive data to it.
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Jan 04, 2012 10:53 am     Reply with quote

stoyanoff wrote:
Can you give me a link to download ccs stack???
I`m using mplab v8.33, ccs v4.078
I`m trying to create my own TCP/IP stack. I`ve used some examples but there is used extra chip (Ethernet controller) connected through SPI interface.
In these case the Ethernet controller is in the chip and I don`t know how to pass/receive data to it.


If you currently have maintenance on the compiler, send CCS an email and ask for it. This will include the low level drivers for the embedded Ethernet controller in the PIC18F97J60 family.

I also have my own stack which is used for my Ethernet bootloaders and other applications. I ported the Microchip ENC28J60, ENCx24J600 and the PIC18F97J60 Ethernet drivers. These drivers, as supplied by Microchip feature a common API and can be readily swapped. This means if you have sample code using the ENC28J60 then porting it to the PIC18F97J60 family is almost as easy as swapping the low level driver file.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Fri Jan 06, 2012 1:55 am     Reply with quote

I've sent a message, but they sent me back a guide to Development Kit for 3.3V Ethernet controller. And there were no drivers. The info they sent me back is more connected to CCS TCP/IP stack. This is not what I mean.
I'm reading the book "Web servers for embedded systems" (W. Bolton). But the author uses controller + ethernet controller. In this case I have an idea what to do because the connection between the chips is through SPI interface.
But in PIC 18F66J60 the ethernet controller is in the chip and it's connected to the data bus of the controller. I want to know how to pass data to this (in this case I think it's interface) ethernet controller. Are there any functions as putc(), printf(), spi_read() which I can use, or should I work with the registers ?
I need a simple example in this style:
Code:

if(spi_data_is_in()){
data=spi_read();
}

Just in my case to be for ethernet interface of PIC18F66J60.
Thanks!
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Fri Jan 06, 2012 2:54 am     Reply with quote

I think you have the wrong idea about what ethernet can do.
_Unless_ you are implementing your own direct connection between devices, then you need to be talking via the stack. Everything on ethernet, is packet based, and round the packet has to be the header identifying who it is for etc.. This is what the stack does for you, and why CCS supply it....
You either have to implement a web page, and put the data into this, or send a 'file' containing the data using a protocol like ftp.

Best Wishes
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Jan 06, 2012 3:18 am     Reply with quote

stoyanoff wrote:

I need a simple example in this style:
Code:

if(spi_data_is_in()){
data=spi_read();
}

Just in my case to be for ethernet interface of PIC18F66J60.
Thanks!


The simple example you used above is how to send / receive a single character via the SPI interface. What you actually need to do is to send and receive some network PDU (protocol data unit) such as a IP packet. For this there is TCP/IP API. You include the stack in your application, access the stack via this API and the software stack performs the necessary building of the data structures and reading and writing the appropriate registers in the Ethernet controller. Using an external controller via the SPI interface, the stack software access registers in the Ethernet controller. As already mentioned, the controllers are low level devices with no knowledge of network protocols - the driver handles all of this.

In your case with an embedded ethernet controller in the POIC, the only thing removed from the equation is the SPI bus linking the PIC to the registers in the Ethernet controller. In the case of the PIC18F66J60 you access the registers via the internal busses in the PIC.

What if you dod not want to use this stack and instead implement your own "simple" interface? I have developed my own minimal stack implementation which is used in my Ethernet bootloaders. There is around 1000 lines of code to implement this simple interface and months of work.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Fri Jan 06, 2012 3:36 am     Reply with quote

I think we talk about the same thing. I`m trying to develop my own stack. I know about the processes of work with IP packages. I know what to put into 1 package, but I don`t know how to send the package to the ethernet controller, or how to recieve a package.
From your answers I understood there are no fuctions so I have to work with the registers.
So, we have a packege in the controller memory(a structure of data), the package is already calculated and ready for send. So I want know how to send this structure of data through the ethernet controller. Where should I transfer this data in which register?And how to flush the data to the line when I`m ready???
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Jan 06, 2012 4:54 am     Reply with quote

If you have the CCS stack then pull it apart to see how it is done. They also use the same PIC.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Fri Jan 06, 2012 7:05 am     Reply with quote

This is a problem. I don`t have CCS stack. Any other ideas???
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Jan 09, 2012 4:19 am     Reply with quote

carefully read the datasheet for the PIC18F that you have.

Communicating with the EtherMAC built into the PIC is explained in there.

You can also download Microchip's tcpip stack (for free) which has drivers for all microchip ethernet enabled products. These source files (which won't compile in CCS) will give you examples of how to talk to the various ethernet products from microchip.


-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
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


Powered by phpBB © 2001, 2005 phpBB Group