Hi all
I am using LPC2378 processor and trying to initialize the ethernet ...i got the ethernet code from the net for MCB2300 board.
my LPC2378 is running on 16MHz crystal. and i am using DM9161 PHY layer which is different from the dev board of DP83848 chip.
I am using keil compiler for debugging the code but when i am trying to initialize the LPC internal register for ethernet .
MAC1 = 0xCF00 ; /*soft resets all MAC internal modules*/ then after some delay MAC_MAC1 = 0x0; /* deassert all of the above soft resets in MAC1 */
the problem occures when i de assert the MAC1 register the debug stops and indicates an error saying "debug cannot stop the ARM module " agter which i am unable to debug the code .
if the ethernet init function is blocked and debugged ,its working fine .
The thing i am unable to understand is the same code is working for me on the dev board MCB2300 boad without any problem.....so wt might be problem with my LPC board .
has any one came accross this problem ....plz provode me with the solution ..
Regards Suresh
You need this before accessing EMAC.
/* Power Up the EMAC controller. */ PCONP |= 0x40000000; /* Enable P1 Ethernet Pins. */ if (MAC_MODULEID == OLD_EMAC_MODULE_ID) { /* For the first silicon rev.'-' ID P1.6 should be set. */ PINSEL2 = 0x50151105; } else { /* on rev. 'A' and later, P1.6 should NOT be set. */ PINSEL2 = 0x50150105; } PINSEL3 = (PINSEL3 & ~0x0000000F) | 0x00000005;
HI Franc this is my ethernet initialization function have a look
DWORD EMACInit( void ) { DWORD regVal; DWORD i; regVal = PCONP; regVal |= PCONP_EMAC_CLOCK; PCONP = regVal; delay_1ms(5); #if RMII /* P1.6, ENET-TX_CLK, has to be set for EMAC to address a BUG in the engineering version, even if this pin is not used for RMII interface. This bug has been fixed, and this port pin can be used as GPIO pin in the future release. */ /* Unfortunately, this MCB2300 board still has the old eng. version LPC23xx chip on it. On the new rev.(xxAY, released on 06/22/2007), P1.6 should NOT be set. See errata for more details. */ regVal = MAC_MODULEID; if ( regVal == PHILIPS_EMAC_MODULE_ID ) { /* This is the rev."-" ID for the existing MCB2300 board, on rev. A, regVal should NOT equal to PHILIPS_EMAC_MODULE_ID, P1.6 should NOT be set. */ PINSEL2 = 0x50151105; /* selects P1[0,1,4,6,8,9,10,14,15] */ } else { PINSEL2 = 0x50150105; /* selects P1[0,1,4,8,9,10,14,15] */ } PINSEL3 = 0x00000005; /* selects P1[17:16] */ #else /* else RMII, then it's MII mode */ PINSEL2 = 0x55555555; /* selects P1[15:0] */ PINSEL3 = 0x00000005; /* selects P1[17:16] */ #endif /*----------------------------------------------------------------------------- * write the MAC config registers *----------------------------------------------------------------------------*/ MAC_MAC1 = 0xCF00; /* [15],[14],[11:8] -> soft resets all MAC internal modules */ MAC_COMMAND = 0x0038; /* reset all datapaths and host registers */ delay_1ms(5); MAC_MAC1 = 0x0; /* deassert all of the above soft resets in MAC1 */ EMAC_TxDisable(); EMAC_RxDisable(); MAC_MAC2 = 0x00; /* Non back to back inter-packet gap */ MAC_IPGR = 0x0012; /* use the default value recommended in the users manual */ MAC_CLRT = 0x370F; /* Use the default value in the users manual */ MAC_MAXF = 0x0600; /* Use the default value in the users manual */
I have used the same function which is used in the initialization for the dev board MCB2300. the problem starts when i execute the MAC1 = 0x00; the systems hangs and says .."could not stop ARM device check the JTAG cable " like i am not able to config or access any of the MAC register .so wt might be the problem..
Hi All, I runed Easyweb samples code on MCB2300 Eval board and my target board, MCB2300 is ok, but my target board always occurs error when executes to MAC_MAC1 = MAC1_PASS_ALL; very similar to your problom, any progress in you solving Regards
======================================= void Init_EMAC(void) { // Keil: function modified to access the EMAC // Initializes the EMAC ethernet controller unsigned int regv,tout,id1,id2;
/* Enable P1 Ethernet Pins. */ PINSEL2 = 0x55555555; PINSEL3 = (PINSEL3 & ~0x0000000F) | 0x00000005;
/* Power Up the EMAC controller. */ PCONP |= 0x40000000;
/* Reset all EMAC internal modules. */ MAC_MAC1 = MAC1_RES_TX | MAC1_RES_MCS_TX | MAC1_RES_RX | MAC1_RES_MCS_RX | MAC1_SIM_RES | MAC1_SOFT_RES; MAC_COMMAND = CR_REG_RES | CR_TX_RES | CR_RX_RES;
/* A short delay after reset. */ for (tout = 100; tout; tout--);
/* Initialize MAC control registers. */ MAC_MAC1 = MAC1_PASS_ALL;