cancel
Showing results for 
Search instead for 
Did you mean: 

the problem about the Ethernet Interrupt, i have debug it two weeks.

aizhixi
Associate II
Posted on May 25, 2013 at 17:43

hello:

i do some tests about the ethernet,when i connected the board with PC use the Ethernet crossover cable,the windows  remind me the connected have some problems.but i don't know why.

maybe the confiure GPIO have some problems,but i configure it as the same with demo(SMT32F407).I change the GPIO as my board.

the configuration is like this:

 /* Configure PA1, PA2 and PA7 */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_7;

  GPIO_Init(GPIOA, &GPIO_InitStructure);

  GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_ETH);

  GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_ETH);

  GPIO_PinAFConfig(GPIOA, GPIO_PinSource7, GPIO_AF_ETH);

  /* Configure PB8 */

  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_8;//GPIO_Pin_5 |

  GPIO_Init(GPIOB, &GPIO_InitStructure);

 // GPIO_PinAFConfig(GPIOB, GPIO_PinSource5, GPIO_AF_ETH);

  GPIO_PinAFConfig(GPIOB, GPIO_PinSource8, GPIO_AF_ETH);

  /* Configure PC1, PC2, PC3, PC4 and PC5 */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5;

  GPIO_Init(GPIOC, &GPIO_InitStructure);

  GPIO_PinAFConfig(GPIOC, GPIO_PinSource1, GPIO_AF_ETH);

  GPIO_PinAFConfig(GPIOC, GPIO_PinSource2, GPIO_AF_ETH);

  GPIO_PinAFConfig(GPIOC, GPIO_PinSource3, GPIO_AF_ETH);

  GPIO_PinAFConfig(GPIOC, GPIO_PinSource4, GPIO_AF_ETH);

  GPIO_PinAFConfig(GPIOC, GPIO_PinSource5, GPIO_AF_ETH);

this is a part of code , i open all the GPIO(connected with PHY )  Alternate Fuction, configure the GPIO like this.

The PYH chip is DP83848C ,The mode of Ethernet i used the MII,I test the RXCLK and TXCLK is 25MHZ, the CLK of PHY is external 25MHZ, I think the  CLK configuration have  no problem.

at the same time ,i can pass the fuction ETH_MACDMA_Config();

then i judge the the status of PHY,

  if (EthInitStatus == 0)

  {

     LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)'' Ethernet Init failed '');

     while(1);

  }

it can pass, that's means the DP83848C have no problem,right?

the  DP83848_PHY_ADDRESS  0x01.

Then  i initialize the LwIP_Init();

HelloWorld_init();// configure the telnet port 23

  while(1)

  {

      System_Periodic_Handle();

  }

the NVIC_Configuration i open the  ETH_IRQn;that's all.

when i run tht software ,the LED of Ethernet is on ,that means the hardware is ok, however,the windows reminds the link have some problems,then i ping the IP ,i found can't work.

then i read the Register of PHY ,

RegValue =ETH_ReadPHYRegister(PHYAddress, PHY_BSR)

the value is the 0x0115, is right?(i think it's right)

now , i don't know i can't come into the interrupt,i don't know why ?

can you help me ?thanks。

0690X00000604zgQAA.png
18 REPLIES 18
aizhixi
Associate II
Posted on May 27, 2013 at 10:27

nobody answer my question, it's  too easy?

have someone met this problem before?

aizhixi
Associate II
Posted on May 28, 2013 at 16:30

check the datasheet of STM32F439.change the software,try to solve the problems,but have not found what's why?

jpeacock2399
Associate II
Posted on May 28, 2013 at 16:33

Debugging Ethernet is not a task for beginners.  You need an in depth knowledge of both TCP/IP protocols and how the underlying signalling works, especially how auto-configure wrks in the PHY you are using.  Do you know if the hardware is configured properly?  The receiver in the PC says it isn't.  There are a large number of parameters involved in setting up Ethernet, especially in the PHY.  I suggest you start by dumping the configuration registers for both the MAC and PHY and verify these are correct.

The next step would be to check if you can receive from the PC.  Set up your TCP/IP stack to receive ICMP and then send a ping from the PC.  If you don't see the message arrive you still have configuration problems.  Are you using auto-configure in the PHY?  Is it 10 or 100 Mbit, half or full duplex, what's the flow control?

You aren't seeing answers because you aren't providing anywhere near enough information to even offer a suggestion.  Try to narrow down where your problem is by using ICMP befoer trying to send TCP or UDP.  That's what the protocol is for, testing network hardware.

  Jack Peacock
infoinfo980
Associate II
Posted on May 28, 2013 at 18:03

From the info you've provided I would guess that the stm32 ethernet part is working as far as the PHY comms are concerned.

Firstly and most importantly: Get ''Wireshark''. Set a filter of something like ip.addr==<your-stm32-ip-address> to watch IP traffic going to and from your stm32. Or go lower and set a filter of just ''icmp'' to watch ICMP traffic.

In Windows your IPv4 connection must be manually configured for a direct cable connection. Disable DHCP (automatically get my <anything> parameters). Enter IPv4 address and subnet mask manually. Disable any other active connection - not strictly necessary as you can manage this with subnets but it's just easier if there's no other traffic.

Put a breakpoint in the Ethernet interrupt handler, or you're polling then in your loop where you check the buffer OWN bit. If the breakpoint is hit then you've got a functional ethernet DMA.

Good luck.
Posted on May 28, 2013 at 21:16

Roy, you have a missing AF configuration

GPIO_PinAFConfig(GPIOA, GPIO_PinSource0, GPIO_AF_ETH);

// ETH_MII_CRS

The board has another issue with the MII_INT, which is on the IO Expander 1 pin
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
bouhoula
Associate II
Posted on May 29, 2013 at 09:41

Try working with a normal cable, and ping your board, what it gives you as a result?

aizhixi
Associate II
Posted on May 31, 2013 at 03:15

thank you for your reply,i need to use the fuction about the ethernet, you know , i have a eval board about the STM32F107, i used the ethernet have no problem,i know about the protoclos.

the hardware be provied by the ST, this is a eval board ,you know, i think the hardware have no problem, at the same ,i check the pins connected PHY , it's ok.

about the configure about the MAC and the PHY Like this,

ETH_DeInit();

ETH_SoftwareReset();

while (ETH_GetSoftwareResetStatus() == SET);

  ETH_StructInit(&ETH_InitStructure);

 /*------------------------   MAC   -----------------------------------*/

  ETH_InitStructure.ETH_AutoNegotiation = ETH_AutoNegotiation_Enable;

  ETH_InitStructure.ETH_LoopbackMode = ETH_LoopbackMode_Disable;

  ETH_InitStructure.ETH_RetryTransmission = ETH_RetryTransmission_Disable;

  ETH_InitStructure.ETH_AutomaticPadCRCStrip =          ETH_AutomaticPadCRCStrip_Disable;

  ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Disable;

  ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Enable;

  ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;

  ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect;

  ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;

  ETH_InitStructure.ETH_DropTCPIPChecksumErrorFrame = ETH_DropTCPIPChecksumErrorFrame_Enable; 

  ETH_InitStructure.ETH_ReceiveStoreForward = ETH_ReceiveStoreForward_Enable;         

  ETH_InitStructure.ETH_TransmitStoreForward = ETH_TransmitStoreForward_Enable;     

 

  ETH_InitStructure.ETH_ForwardErrorFrames = ETH_ForwardErrorFrames_Disable;       

  ETH_InitStructure.ETH_ForwardUndersizedGoodFrames = ETH_ForwardUndersizedGoodFrames_Disable;   

  ETH_InitStructure.ETH_SecondFrameOperate = ETH_SecondFrameOperate_Enable;

  ETH_InitStructure.ETH_AddressAlignedBeats = ETH_AddressAlignedBeats_Enable;      

  ETH_InitStructure.ETH_FixedBurst = ETH_FixedBurst_Enable;                

  ETH_InitStructure.ETH_RxDMABurstLength = ETH_RxDMABurstLength_32Beat;          

  ETH_InitStructure.ETH_TxDMABurstLength = ETH_TxDMABurstLength_32Beat;

  ETH_InitStructure.ETH_DMAArbitration = ETH_DMAArbitration_RoundRobin_RxTx_2_1;

  

  EthInitStatus = ETH_Init(&ETH_InitStructure, DP83848_PHY_ADDRESS);

  ETH_DMAITConfig(ETH_DMA_IT_NIS | ETH_DMA_IT_R, ENABLE);

i write it refer to the STM32F407 eval board configure the Ethernet.

i read the PHY SR , the value is 0x4115, means use the 

 100 Mbit ,

full duplex

i can't use the ICMO to verify the ethernet,because of if receivet the data form the PC, it can't trigger the interrupt ,means that i can't analytic data process,you know, the problem is here,if receive the data form PC,the led of Ethernet is on.i think the MCU receive the data  but can't trigger the event.i have enbale the interrupt.you know.

this is framework.

  eth_config();

  LwIP_Init();

  HelloWorld_init();

  while(1)

  {

           System_Periodic_Handle();

  }

interrupt:

void ETH_IRQHandler(void)

{

  /* Handles all the received frames */

  while(ETH_CheckFrameReceived() != 0) 

  {

    LwIP_Pkt_Handle();

  }

  /* Clear the Eth DMA Rx IT pending bits */

  ETH_DMAClearITPendingBit(ETH_DMA_IT_R);

  ETH_DMAClearITPendingBit(ETH_DMA_IT_NIS);

}

void NVIC_Configuration(void)

{

  

   NVIC_InitTypeDef   NVIC_InitStructure;

  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); 

  

  /* Enable the Ethernet global Interrupt  */

  NVIC_InitStructure.NVIC_IRQChannel = ETH_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;

  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);    

}

LWIP i used the 1.3.1 vercation.

now i don't know where the problems are .

thank you for your reply,

best regard 

ROY aizhixi@gmail.com

aizhixi
Associate II
Posted on May 31, 2013 at 03:48

i try the normal one, have the same condition. 

best regard 

ROY aizhixi@gmail.com

aizhixi
Associate II
Posted on June 03, 2013 at 02:55

No progress has been.