cancel
Showing results for 
Search instead for 
Did you mean: 

Stm324x9I-Eval Ethernet Link Software Interrupt

jagdish
Associate II
Posted on September 23, 2014 at 13:04

Hello,

Kindly guide me in resolving the following issue.

I am working on STM324x9I-Eval board Ethernet example using LwIP example.

On connecting/disconnecting the Ethernet cable from connector CN10 on the board, I wanted an software interrupt to get generated.

Is there any example that serves the purpose.

thanks

Jagdish

#stm32f4 #ethernet
3 REPLIES 3
stm322399
Senior
Posted on September 23, 2014 at 14:04

This is not a straightforward task given the wiring of this board (mine is 429I), follow these steps:

1) Get communication with the IO expander (using i2C bus)

2) Init IO expander to set I/O1(normally connected to the INT output of the PHY) as input and generating an interrupt

3) Install an interrupt handler for IO expander (EXTI8 source on multiplexed EXTI9_5_IRQHandler)

4) Use MDIO channel of EMAC to communicate with the PHY

5) Initialize PHY to generate an interrupt on link status update

When you catch the interrupt:

1) Verify on EXTI controller that the source is EXTI8

2) Check on IO expander that it come from I/O1

3) Read PHY status

jagdish
Associate II
Posted on September 24, 2014 at 05:55

Is there any link available that shares such implementation of initializing and usage of IO expander.

stm322399
Senior
Posted on September 24, 2014 at 09:05

The minimum steps required to initialize the IOEXP (given that we have the same STMPE1600) is to enable interrupt on the IO/1 and enable generation of external interrupts:

IOEXP_write8(IEGPIOR_LSB,1<<1); IOEXP_write8(SYSTEM_CONTROL, 4); The write function is a generic I2C write function using the Standard Peripheral Lib:

void IOEXP_write8(uint8_t regnum, uint8_t value)
{
I2C_GenerateSTART(I2C1, ENABLE);
while ( I2C_GetFlagStatus(I2C1, I2C_FLAG_SB) == RESET );
I2C_Send7bitAddress(I2C1, IOEXP_ADDR*2, I2C_Direction_Transmitter);
while ( I2C_GetFlagStatus(I2C1, I2C_FLAG_ADDR) == RESET );
I2C_GetFlagStatus(I2C1, I2C_FLAG_MSL);
while ( I2C_GetFlagStatus(I2C1, I2C_FLAG_TXE) == RESET );
I2C_SendData(I2C1, regnum);
while ( I2C_GetFlagStatus(I2C1, I2C_FLAG_TXE) == RESET );
I2C_SendData(I2C1, value);
while ( I2C_GetFlagStatus(I2C1, I2C_FLAG_TXE) == RESET );
I2C_GenerateSTOP(I2C1, ENABLE);
while ( I2C_GetFlagStatus(I2C1, I2C_FLAG_BUSY) == SET );
}