Created Tue, 26 Jun 2012 17:16:13 +0000 by NMC
Tue, 26 Jun 2012 17:16:13 +0000
I am using a Cerebot MX7cK and I've installed the chipKITEthernet library support for Microchip TCPIP Stack (available here: DSD-0000318. The main functions are at the file: chipKIT Network_and_USB_Libs\chipKITEthernet\utility\chipKITEthernetAPI.h
After some changes I was capable of compiling all the code needed, I've chosen the parameters, etc... but the problem is that the function ChipKITEthernetBegin(rgbMac, rgbIP, rgbGateWay, rgbSubNet, rgbDNS1, rgbDNS2) isn't working properly... The 2 ethernet port leds blink, the program reaches the while loop but no connection is set because the board doesn't appear in the ARP table, so I can't ping or found it.
Does anyone know how to fix this? Or does have a working code to this board using the ethernet module?
there is my main.c (the leds are just for help debugging)
#include <plib.h> /* Include to use PIC32 peripheral libraries */
#include <stdint.h> /* For uint32_t definition */
#include <stdbool.h> /* For true/false definition */
#include "system.h" /* System funct/params, like osc/periph config */
#include "user.h" /* User funct/params, such as InitApp */
#define THIS_IS_STACK_APPLICATION
#include "chipKITEthernetAPI.h"
main(void)
{
/* TODO Add user clock/system configuration code if appropriate. */
SYSTEMConfig(SYS_FREQ, SYS_CFG_ALL);
/* Initialize I/O and Peripherals for application */
InitApp();
SYSTEMConfigWaitStatesAndPB(80000000);
// we need to configure for multi-vectored interrupts
INTEnableSystemMultiVectoredInt();
//Set LD1 through LD4 as digital output - Set ports for onboard LEDs to outputs
PORTSetPinsDigitalOut (IOPORT_G, BIT_12|BIT_13|BIT_14|BIT_15);
PORTSetPinsDigitalIn (IOPORT_G, BIT_6|BIT_7);
PORTSetPinsDigitalIn (IOPORT_A, BIT_0);
PORTClearBits (IOPORT_G, BIT_12|BIT_13|BIT_14|BIT_15);
SYSTEMConfigPerformance(SYS_FREQ);
BYTE rgbMac[6] = {0x00,0x18,0x3E,0x01,0x12,0x94};
BYTE rgbIP[4] = {192,168,1,100};
BYTE rgbGateWay[4] = {192,168,1,254};
BYTE rgbSubNet[4] = {255,255,255,0};
BYTE rgbDNS1[4] = {0,0,0,0};
BYTE rgbDNS2[4] = {0,0,0,0};
/****************************************************************************
void ChipKITEthernetBegin(const BYTE *rgbMac, const BYTE *rgbIP, const BYTE *rgbGateWay, const BYTE *rgbSubNet, const BYTE *rgbDNS1, const BYTE *rgbDNS2)
Description:
This routine impements the Arduino Ethernet.Begin Method. This initializes the
board, start supporting tasks, builds a default application configuration data structure,
overrides the configuration structure if static IPs or assigned MACs are specified,
and starts the Ethernet stack.
Parameters:
rgbMac - If all 6 bytes are zero, than use the internal MCU programed MAC address
as defined by Microchip. It will be a unique MAC address in the Microchip range.
The range will be somewhere starting with 00:04:A3:XX:XX:XX
If non-zero, the specified MAC address will be used.
rgbIP - If all 4 bytes are zero, then DHCP is used and rest of the parameters are ignored
If an IP is specified then DHCP is not used and the IP represents a static IP address to use. The
remainng parameters have value.
rgbGateWay - 4 bytes IP address of the gateway to use. Only valid if rgbIP is specified
rgbSubNet - 4 byte mask representing the subnet mask.Only valid if rgbIP is specified
rgbDNS1 - 4 byte IP address of the primary DNS server. Only valid if rgbIP is specified. This value may be 0s if not required
rgbDNS2 - 4 byte IP address of the secondary DNS server. Only valid if rgbIP is specifed. This value may be 0s if not required
***************************************************************************/
PORTSetBits (IOPORT_G, BIT_15);
ChipKITEthernetBegin(rgbMac, rgbIP, rgbGateWay, rgbSubNet, rgbDNS1, rgbDNS2);
PORTSetBits (IOPORT_G, BIT_12);
while(1)
{
StackTask(); // tried ChipKITPeriodicTasks() too
if (PORTReadBits (IOPORT_G, BIT_6))
{
PORTClearBits (IOPORT_G, BIT_12);
}
}
}
Thanks
Tue, 26 Jun 2012 19:15:33 +0000
Does this only happen with ChipKITEthernet.Begin(rgbMac, rgbIP, rgbGateWay, rgbSubNet, rgbDNS1, rgbDNS2) or any Begin overload?
I'm having almost exactly the same issue right now. I'm bringing up a new board and everything seems to be working (LED's on the connector come on) serial work, except I can't see the board on the network.
Some background:
The MDC/MDIO lines are serial communications between the uC and the phy that ask a question like is there an active link on the phy? If I pull my Network Shield off of my Max32 the MDIO line will ask a single question (need a digital scope to see this) at start up but then stay low (~0V). So something is causing the chipKIT code to stop asking questions of the phy if its not there at startup.
On the board I'm working on I also notice that the MDIO line has no communications on it (not even at startup) and is sitting at logic high (~3.3V). The 2MHz MDC clock is present on my board however.
I've been trying to follow the chipKIT Ehternet to try and figure out why the PIC32 is not even asking a question on startup on my board. This is as far as I have gotten to up to this point.
Jacob