|
|
View previous topic :: View next topic |
Author |
Message |
poyns
Joined: 03 Jul 2006 Posts: 5
|
direct ethernet connection from laptop to 18F6722 |
Posted: Wed Jul 05, 2006 12:05 pm |
|
|
A newbie question!
I need to connect my laptop directly to the prototype board via a network cable (that is with no external network involved) so that the laptop can send frames and IP packets to the chip and recive replys, the kit is an embedded internet development kit with a 18F6722 chipset (TCP/IP stack is available).
I would be grateful for any suggestions, poyns. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Wed Jul 05, 2006 7:02 pm |
|
|
If you mean how to physically do it then you need a $5 Ethernet cross-over cable. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Jul 05, 2006 8:06 pm |
|
|
Or 2 Ethernet cables and a hub (or switch) |
|
|
poyns
Joined: 03 Jul 2006 Posts: 5
|
|
Posted: Sat Jul 08, 2006 2:22 am |
|
|
thanks guys, I have the cross-over cable but I can't ping the board, do I need to make changes to the laptop settings? |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Sat Jul 08, 2006 3:52 am |
|
|
That's a whole different question with not a lot of information:
1. Does the kit already have an application installed?
2. If you are using a crossover cable did you assign an IP address to you PCs network card? (by default it will try and use DHCP but with a cross over cable there is no DHCP server to provide the address)?
3. Did you assign the PCs IP address in the same subnet as the Kit?
4. Do you have a firewall configured on the PC and if so have you enabled ICMP to pass thru?
5. Do you have a packet sniffer (such as the excellant and free Ethereal) to see what is happening?
6. Is the Ethernet development board based on the Microchip ENC28J60 and if so does the link LED come on and stay on when plugged into the PC?
7. Following on from 6, Do the activity LED falsh when packets are transmitted?
8. Specifically which Ethernet development board are you using? _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
poyns
Joined: 03 Jul 2006 Posts: 5
|
|
Posted: Sat Jul 08, 2006 4:46 am |
|
|
Cheers for the reply Andrew
1) I'm using the CCS embedded internet kit with an 18F6722 chip and the Embedded Ethernet Board is a Realtek RTL8019A3 rather than the MCP ENC28J60. There is a TCP/IP stack and I'm attempting to run the
sample program(sets up ARP and ICMP handling) that allows the board to be pinged. The program compiles and loads via the ICD-U40 no problem
There are 4 ethernet status leds, BNC is on, link is off and Rx and Tx are on constantly.
2) I assigned a static IP address 169.254.0.0 (subnet mask 255.255.0.0) to my NIC and 169.254.0.1 to the kit's code for the board. Firewall is turned off, pinging from the command line gives request timeout,
I've tried Ethereal to capture everything from 169.254.0.1 and 169.254.0.0 but no returns. The status leds dont flash when I ping the board.
The code:
//////////////////////////////////////////////////////////////////////////////
//
// ex10a.c - Example 10A from the Embedded Internet/Embedded Ethernet tutorial
//
// Answer any Ping (ICMP) requests sent to this unit.
//
// NOTE: Change the code in IPAddrInit() to your desired IP address, which
// is based on your network.
//
//////////////////////////////////////////////////////////////////////////////
#define STACK_USE_ICMP 1
#define STACK_USE_ARP 1
#include "ccstcpip.h"
#include "drivers\dlcd.c"
enum {ARP_ST_IDLE=0, ARP_ST_REPLY=1} my_arp_state=0;
NODE_INFO arp_req_src;
void my_arp_task(void) {
switch (my_arp_state) {
case ARP_ST_REPLY:
if ( ARPIsTxReady() ) {
ARPPut(&arp_req_src, ARP_REPLY);
my_arp_state=ARP_ST_IDLE;
printf(lcd_putc,"\fARP reply\n");
}
break;
default:
break;
}
}
char my_icmp_data[64];
enum {ICMP_ST_IDLE=0, ICMP_ST_REPLY=1} my_icmp_state=0;
int16 ICMP_Id, ICMP_Seq;
int8 ICMP_Size;
ICMP_CODE iCode;
NODE_INFO icmp_node;
void my_icmp_task(void) {
switch(my_icmp_state) {
case ICMP_ST_REPLY:
if (ICMPIsTxReady()) {
ICMPPut(&icmp_node, ICMP_ECHO_REPLY, my_icmp_data, ICMP_Size,
ICMP_Id, ICMP_Seq);
printf(lcd_putc,"\fICMP reply\n"); // comment appears on lcd
my_icmp_state = ICMP_ST_IDLE;
}
break;
default:
break;
}
}
void main(void) {
IP_ADDR localIP;
ICMP_CODE icode;
NODE_INFO src;
int8 opCode, type, protocol;
int16 len;
set_tris_b(0);
printf("\r\n\nCCS TCP/IP TUTORIAL, EXAMPLE 10A (ICMP RESPOND)\r\n");
lcd_init();
printf(lcd_putc,"\fWaiting dude!\n");
MACAddrInit();
IPAddrInit();
MACInit();
while(TRUE) {
if (MACGetHeader(&src.MACAddr, &type)) {
if (type==MAC_ARP) {
if (ARPGet(&arp_req_src, &opCode)) {
printf(lcd_putc,"\fARP MAC reply\n");
output_toggle(USER_LED1);
my_arp_state=ARP_ST_REPLY;
}
}
else if (type==MAC_IP) {
if (IPGetHeader(&localIP,&src,&protocol,&len)) {
if (protocol == IP_PROT_ICMP) {
ICMP_Size=len;
if (ICMPGet(&iCode, my_icmp_data, &ICMP_Size,
&ICMP_Id, &ICMP_Seq)) {
if (iCode == ICMP_ECHO_REQUEST) {
memcpy(&icmp_node,&src,sizeof(NODE_INFO));
output_toggle(USER_LED2);
my_icmp_state=ICMP_ST_REPLY;
}
}
}
}
}
}
my_icmp_task();
my_arp_task();
}
}
regards poyns |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Sat Jul 08, 2006 4:55 am |
|
|
You should not use IP address 169.254.0.0 for your PC. With your assigned mask this translates to the subnet address. Some devices can work with this but most will not. Try using 169.254.0.2 for your PC.
One you have changed the address on the PC and tried to ping, do an arp -a from the command line and see if the arp table is being populated with the MAC address of you board.
The Realtek has a quirk in that it generally requires an on board EEPROM 93Cxx connected directly to the Realtek to configure the behaviour of the LEDs. If there is no EEPROM on the board then there are a couple of work arounds, emulate the EEPROM with the PIC or fool the Realtek into thinking is is using the BNC interface which ends up giving you LINK on one LED and activity on another. Without knowig the specific hardware configuration of the board you are using I cannot tell what the LED behaviour will be. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
poyns
Joined: 03 Jul 2006 Posts: 5
|
|
Posted: Sat Jul 08, 2006 8:32 am |
|
|
I changed the NIC's address but the ping still times out and there's no entries in the ARP cache.
cheers Seamus |
|
|
|
|
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
|