Created Tue, 15 Apr 2014 15:56:29 +0000 by tahoe250
Tue, 15 Apr 2014 15:56:29 +0000
Hello Everyone,
I am trying to get the TCP/IP to work with MPLAB X and it has proven to be a significant challenge. Has anyone gotten the chipkit PRO MX7cx to work with just the microchip tcp/ip stack. If you could please point me in the correct direction. Currently i am using the XC32-PIC32_ETH_SK_ETH795 demo and trying adjust it for the chipkit PRO MX7cx board. Currently i cant even PING the board and i have ICMP enabled. I am using the exact hardwareprofile.h that apparently is used in the arduino development as well as the TCPconfig.h file. My application now is
Initialize board basically doing this TRISAbits.TRISA6 = 0; // output phy enable SMSC8720, data part of the NIC DelayMs(100); LATAbits.LATA6 = 1; // high, enable the phy
The call this function // Initialize stack-related hardware components that may be // required by the UART configuration routines TickInit();
Then call static void InitAppConfig(void) {
while(1) { // Start out zeroing all AppConfig bytes to ensure all fields are // deterministic for checksum generation memset((void*)&AppConfig, 0x00, sizeof(AppConfig));
AppConfig.Flags.bIsDHCPEnabled = TRUE;
AppConfig.Flags.bInConfigMode = TRUE;
memcpypgm2ram((void*)&AppConfig.MyMACAddr, (ROM void*)SerializedMACAddress, sizeof(AppConfig.MyMACAddr));
// { // _prog_addressT MACAddressAddress; // MACAddressAddress.next = 0x157F8; // _memcpy_p2d24((char*)&AppConfig.MyMACAddr, MACAddressAddress, sizeof(AppConfig.MyMACAddr)); // } AppConfig.MyIPAddr.Val = MY_DEFAULT_IP_ADDR_BYTE1 | MY_DEFAULT_IP_ADDR_BYTE2<<8ul | MY_DEFAULT_IP_ADDR_BYTE3<<16ul | MY_DEFAULT_IP_ADDR_BYTE4<<24ul; AppConfig.DefaultIPAddr.Val = AppConfig.MyIPAddr.Val; AppConfig.MyMask.Val = MY_DEFAULT_MASK_BYTE1 | MY_DEFAULT_MASK_BYTE2<<8ul | MY_DEFAULT_MASK_BYTE3<<16ul | MY_DEFAULT_MASK_BYTE4<<24ul; AppConfig.DefaultMask.Val = AppConfig.MyMask.Val; AppConfig.MyGateway.Val = MY_DEFAULT_GATE_BYTE1 | MY_DEFAULT_GATE_BYTE2<<8ul | MY_DEFAULT_GATE_BYTE3<<16ul | MY_DEFAULT_GATE_BYTE4<<24ul; AppConfig.PrimaryDNSServer.Val = MY_DEFAULT_PRIMARY_DNS_BYTE1 | MY_DEFAULT_PRIMARY_DNS_BYTE2<<8ul | MY_DEFAULT_PRIMARY_DNS_BYTE3<<16ul | MY_DEFAULT_PRIMARY_DNS_BYTE4<<24ul; AppConfig.SecondaryDNSServer.Val = MY_DEFAULT_SECONDARY_DNS_BYTE1 | MY_DEFAULT_SECONDARY_DNS_BYTE2<<8ul | MY_DEFAULT_SECONDARY_DNS_BYTE3<<16ul | MY_DEFAULT_SECONDARY_DNS_BYTE4<<24ul;
// Load the default NetBIOS Host Name
memcpypgm2ram(AppConfig.NetBIOSName, (ROM void*)MY_DEFAULT_HOST_NAME, 16);
FormatNetBIOSName(AppConfig.NetBIOSName);
// Compute the checksum of the AppConfig defaults as loaded from ROM
wOriginalAppConfigChecksum = CalcIPChecksum((BYTE*)&AppConfig, sizeof(AppConfig));
break;
}
}
Then Reconfigure my MAC, IPaddress, Gateway, DNS etc.. // see if we have something other than to use our MAC address if((rgbMac[0] | rgbMac[1] | rgbMac[2] | rgbMac[3] | rgbMac[4] | rgbMac[5]) != 0) { memcpy(&AppConfig.MyMACAddr, rgbMac, 6); }
// if we are not to use DHCP; fill in what came in. if((rgbIP[0] | rgbIP[1] | rgbIP[2] | rgbIP[3]) != 0) { AppConfig.Flags.bIsDHCPEnabled = FALSE; // don't use dhcp memcpy(&AppConfig.MyIPAddr, rgbIP, 4); memcpy(&AppConfig.MyGateway, rgbGateWay, 4); memcpy(&AppConfig.MyMask,rgbSubNet, 4); memcpy(&AppConfig.PrimaryDNSServer, rgbDNS1, 4); memcpy(&AppConfig.SecondaryDNSServer, rgbDNS2, 4);
AppConfig.DefaultIPAddr = AppConfig.MyIPAddr;
AppConfig.DefaultMask = AppConfig.MyMask;
}
// Initialize core stack layers (MAC, ARP, TCP, UDP) and
// application modules (HTTP, SNMP, etc.) StackInit();
Then in a while loop
while(1)
{
// This task performs normal stack task including checking
// for incoming packet, type of packet and calling
// appropriate stack entity to process it.
StackTask();
// This tasks invokes each of the core stack application tasks
StackApplications();
}
Can anyone suggest anything please!!!!!.
Thu, 22 May 2014 22:03:41 +0000
I just saw your post and was wondering if are you still struggling with this?
I've been working with the chipKIT WF32 board in MPLAB X and have got the stock Microchip TCP/IP stack working as a WiFi server using a modified version of the Microchip WiFiG demo. Of course, this is quite different than your ethernet connection, but you seem to be following a similar path. I just thought I'd forward a response that the native Microchip TCP/IP stack does indeed work with the chipKIT boards. In my case, the Microchip WiFiG demo board is a very similar (MCU + WiFiG module) to the WF32 hardware. Still, there were a number of configuration files and source code files to be altered.
I used the TCP/IP Stack in the 2013-06-15 library and I am running MPLAB X v2.05. I assume you also have Microchip debug hardware.
-Max