FreeRTOS with ethernet
Dear Richard,
As mentioned, we need to plug our design board on top of STR91x. But we found a problem, the Ethernet in FreeRTOS on STR91x use the GPIO5 with
GPIO_Struct.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3;
……
……
GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt2;
but we need the GPIO5 (Pin 0 and Pin 1) to be our extend memory addressing and must be set as:
GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt1;
It causes the Ethernet not working at all!! Any solution? Can we use another Pin as Ethernet?
Rickey Leung
FreeRTOS with ethernet
Dear Rickey,
STR91x should allow to configure each in PIN in independent manner. In your case you can try something like this:
void GpioCongiguration()
{
…
GPIO_DeInit(GPIO5);
GPIO_Struct.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3;
GPIO_Struct.GPIO_Type = GPIO_Type_PushPull;
GPIO_Struct.GPIO_Direction = GPIO_PinOutput;
GPIO_Struct.GPIO_IPInputConnected = GPIO_IPInputConnected_Disable;
GPIO_Struct.GPIO_Alternate=GPIO_OutputAlt2;
GPIO_Init(GPIO5, &GPIO_Struct);
GPIO_Struct.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;
GPIO_Struct.GPIO_Alternate=GPIO_OutputAlt1;
GPIO_Init(GPIO5, &GPIO_Struct);
…
}
This code doesn’t prevent Ethernet to work.
Regards,
Stefano
FreeRTOS with ethernet
Many thx~ It solved!
But another problem is we need to address the ext. memory (21e00000) in ST91x. I have configured the EMI as follow but still failed~ can you help me?
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5 |GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt3;
GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Disable;
GPIO_Init (GPIO5, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt2;
GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Disable;
GPIO_Init (GPIO7, &GPIO_InitStructure);
GPIO_Init (GPIO8, &GPIO_InitStructure);
GPIO_Init (GPIO9, &GPIO_InitStructure);
// those bastards. this one pin out of 24 is on a different alt bus
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt3;
GPIO_Init (GPIO7, &GPIO_InitStructure);
// configure SCU
SCU_EMIModeConfig(SCU_EMI_DEMUX);
SCU_EMIBCLKDivisorConfig(SCU_EMIBCLK_Div1); // or SCU_EMIBCLK_Div1;
SCU->GPIOEMI = 1; // enable ports 8 & 9 for EMI
GPIO_EMIConfig( ENABLE );
/* Enable EMI clock */
EMI_DeInit();
EMI_StructInit( &eMI_InitStruct );
eMI_InitStruct.EMI_Bank_MemWidth = EMI_Width_HalfWord;
eMI_InitStruct.EMI_Bank_IDCY =0x6;
eMI_InitStruct.EMI_Bank_WSTRD =0x6;
eMI_InitStruct.EMI_Bank_WSTWR =0x6;
eMI_InitStruct.EMI_Bank_WSTROEN=0x6;
eMI_InitStruct.EMI_Bank_WSTWEN=0x08;
eMI_InitStruct.EMI_Bank_MemWidth=EMI_Width_HalfWord;
EMI_Init( EMI_Bank1, &eMI_InitStruct );
FreeRTOS with ethernet
Dear Rickey,
have you given a look at the application note from ST?
http://www.st.com/mcu/modules.php?name=mcu&file=familiesdocs&FAM=101
There is one that describe how to configure the STR9 EMI:
AN2647 – Using the STR91xFA external memory interface (EMI)
Best regards,
Stefano