I am trying to get ethernet working using the NXPDriverLibraries from http://support.code-red-tech.com/CodeRedWiki/NXPDriverLibraries
I am using red_suite and have created a lpc17xx project there and included the drivers from the driver package.
I have already checked if my ethernet is working with a example from the cookbook from this site and that was ok.
During the initialization of the emac driver from that package my system hangs and i don't understand what I am doing wrong.
In the emac driver there is a reset procedure:
/* Reset all EMAC internal modules */
LPC_EMAC->MAC1 = EMAC_MAC1_RES_TX | EMAC_MAC1_RES_MCS_TX | EMAC_MAC1_RES_RX | EMAC_MAC1_RES_MCS_RX | EMAC_MAC1_SIM_RES | EMAC_MAC1_SOFT_RES;
LPC_EMAC->Command = EMAC_CR_REG_RES | EMAC_CR_TX_RES | EMAC_CR_RX_RES | EMAC_CR_PASS_RUNT_FRM;
When I comment those 2 lines the system doesn't hang, but then if I want to check if there is data received with the EMAC_CheckReceiveIndex function the system hangs again.
This function does nothing more then comparing 2 registers:
Bool EMAC_CheckReceiveIndex(void)
{
if (LPC_EMAC->RxConsumeIndex != LPC_EMAC->RxProduceIndex) {
return TRUE;
} else {
return FALSE;
}
}
In my main function I call the SystemInit(); function and I init the pins and call the EMAC_init function as following:
PINSEL_CFG_Type EmacPin;
EMAC_CFG_Type ethConfig;
EmacPin.Portnum = PINSEL_PORT_1;
EmacPin.Funcnum = PINSEL_FUNC_1;
/* TXD0 */
EmacPin.Pinnum = PINSEL_PIN_0;
PINSEL_ConfigPin(&EmacPin);
/* TXD1 */
EmacPin.Pinnum = PINSEL_PIN_1;
PINSEL_ConfigPin(&EmacPin);
/* RXD0 */
EmacPin.Pinnum = PINSEL_PIN_9;
PINSEL_ConfigPin(&EmacPin);
/* RXD1 */
EmacPin.Pinnum = PINSEL_PIN_10;
PINSEL_ConfigPin(&EmacPin);
/* Configure Ethernet */
ethConfig.Mode = EMAC_MODE_AUTO;
ethConfig.pbEMAC_Addr = (uint8_t *)myMAC;
EMAC_Init(ðConfig);
I am trying to get ethernet working using the NXPDriverLibraries from http://support.code-red-tech.com/CodeRedWiki/NXPDriverLibraries
I am using red_suite and have created a lpc17xx project there and included the drivers from the driver package.
I have already checked if my ethernet is working with a example from the cookbook from this site and that was ok.
During the initialization of the emac driver from that package my system hangs and i don't understand what I am doing wrong.
In the emac driver there is a reset procedure:
When I comment those 2 lines the system doesn't hang, but then if I want to check if there is data received with the EMAC_CheckReceiveIndex function the system hangs again.This function does nothing more then comparing 2 registers:
In my main function I call the SystemInit(); function and I init the pins and call the EMAC_init function as following: