# FreeRTOS with ethernet

**URL:** <https://forums.freertos.org/t/freertos-with-ethernet/2415>\
**Category:** Kernel\
**Created:** [December 16, 2008, 3:55am UTC](https://forums.freertos.org/t/freertos-with-ethernet/2415 "2008-12-16T03:55:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 16, 2008, 3:55am UTC](https://forums.freertos.org/t/freertos-with-ethernet/2415/1 "2008-12-16T03:55:24Z")

</div>

**[dotdotdog](https://sourceforge.net/u/dotdotdog/)** wrote on [Tuesday, December 16, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/636ef82c/#e0d1):

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

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 16, 2008, 9:50am UTC](https://forums.freertos.org/t/freertos-with-ethernet/2415/2 "2008-12-16T09:50:16Z")

</div>

**[stf12](https://sourceforge.net/u/stf12/)** wrote on [Tuesday, December 16, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/636ef82c/#e0d1/811e):

Dear Rickey,

STR91x should allow to configure each in PIN in independent manner. In your case you can try something like this:

void GpioCongiguration()  
{  
&nbsp; …  
&nbsp; GPIO\_DeInit(GPIO5);  
&nbsp; GPIO\_Struct.GPIO\_Pin = GPIO\_Pin\_2 | GPIO\_Pin\_3;  
&nbsp; GPIO\_Struct.GPIO\_Type = GPIO\_Type\_PushPull;  
&nbsp; GPIO\_Struct.GPIO\_Direction = GPIO\_PinOutput;  
&nbsp; GPIO\_Struct.GPIO\_IPInputConnected = GPIO\_IPInputConnected\_Disable;  
&nbsp; GPIO\_Struct.GPIO\_Alternate=GPIO\_OutputAlt2;  
&nbsp; GPIO\_Init(GPIO5, &GPIO\_Struct);

&nbsp; GPIO\_Struct.GPIO\_Pin = GPIO\_Pin\_0 | GPIO\_Pin\_1;  
&nbsp; GPIO\_Struct.GPIO\_Alternate=GPIO\_OutputAlt1;  
&nbsp; GPIO\_Init(GPIO5, &GPIO\_Struct);  
&nbsp; …  
}

This code doesn’t prevent Ethernet to work.

Regards,  
Stefano

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 16, 2008, 10:59am UTC](https://forums.freertos.org/t/freertos-with-ethernet/2415/3 "2008-12-16T10:59:53Z")

</div>

**[dotdotdog](https://sourceforge.net/u/dotdotdog/)** wrote on [Tuesday, December 16, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/636ef82c/#e0d1/811e/6959):

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?

&nbsp;&nbsp;&nbsp; GPIO\_InitTypeDef GPIO\_InitStructure;  
&nbsp;&nbsp;&nbsp; GPIO\_InitStructure.GPIO\_Direction = GPIO\_PinOutput;  
&nbsp;&nbsp;&nbsp; GPIO\_InitStructure.GPIO\_Pin = GPIO\_Pin\_4 | GPIO\_Pin\_5 |GPIO\_Pin\_6 | GPIO\_Pin\_7;  
&nbsp;&nbsp;&nbsp; GPIO\_InitStructure.GPIO\_Type = GPIO\_Type\_PushPull ;  
&nbsp;&nbsp;&nbsp; GPIO\_InitStructure.GPIO\_Alternate = GPIO\_OutputAlt3;  
&nbsp;&nbsp;&nbsp; GPIO\_InitStructure.GPIO\_IPInputConnected = GPIO\_IPInputConnected\_Disable;  
&nbsp;&nbsp;&nbsp; GPIO\_Init (GPIO5, &GPIO\_InitStructure);

&nbsp;&nbsp;&nbsp; GPIO\_InitStructure.GPIO\_Direction = GPIO\_PinOutput;  
&nbsp;&nbsp;&nbsp; GPIO\_InitStructure.GPIO\_Pin = GPIO\_Pin\_All;  
&nbsp;&nbsp;&nbsp; GPIO\_InitStructure.GPIO\_Type = GPIO\_Type\_PushPull ;  
&nbsp;&nbsp;&nbsp; GPIO\_InitStructure.GPIO\_Alternate = GPIO\_OutputAlt2;  
&nbsp;&nbsp;&nbsp; GPIO\_InitStructure.GPIO\_IPInputConnected = GPIO\_IPInputConnected\_Disable;  
&nbsp;&nbsp;&nbsp; GPIO\_Init (GPIO7, &GPIO\_InitStructure);  
&nbsp;&nbsp;&nbsp; GPIO\_Init (GPIO8, &GPIO\_InitStructure);  
&nbsp;&nbsp;&nbsp; GPIO\_Init (GPIO9, &GPIO\_InitStructure);

&nbsp;&nbsp;&nbsp; // those bastards. this one pin out of 24 is on a different alt bus  
&nbsp;&nbsp;&nbsp; GPIO\_InitStructure.GPIO\_Pin = GPIO\_Pin\_7;  
&nbsp;&nbsp;&nbsp; GPIO\_InitStructure.GPIO\_Alternate = GPIO\_OutputAlt3;  
&nbsp;&nbsp;&nbsp; GPIO\_Init (GPIO7, &GPIO\_InitStructure);

&nbsp;&nbsp;&nbsp; // configure SCU  
&nbsp;&nbsp;&nbsp; SCU\_EMIModeConfig(SCU\_EMI\_DEMUX);  
&nbsp;&nbsp;&nbsp; SCU\_EMIBCLKDivisorConfig(SCU\_EMIBCLK\_Div1); // or SCU\_EMIBCLK\_Div1;  
&nbsp;&nbsp;&nbsp; SCU-\>GPIOEMI = 1; // enable ports 8 & 9 for EMI

&nbsp;&nbsp;&nbsp; GPIO\_EMIConfig( ENABLE );

&nbsp;&nbsp;&nbsp; /\* Enable EMI clock \*/  
&nbsp;&nbsp;&nbsp; EMI\_DeInit();  
&nbsp;&nbsp;&nbsp; EMI\_StructInit( &eMI\_InitStruct );  
&nbsp;&nbsp;&nbsp; eMI\_InitStruct.EMI\_Bank\_MemWidth = EMI\_Width\_HalfWord;  
&nbsp;&nbsp;&nbsp; eMI\_InitStruct.EMI\_Bank\_IDCY =0x6;  
&nbsp;&nbsp;&nbsp; eMI\_InitStruct.EMI\_Bank\_WSTRD =0x6;  
&nbsp;&nbsp;&nbsp; eMI\_InitStruct.EMI\_Bank\_WSTWR =0x6;  
&nbsp;&nbsp;&nbsp; eMI\_InitStruct.EMI\_Bank\_WSTROEN=0x6;  
&nbsp;&nbsp;&nbsp; eMI\_InitStruct.EMI\_Bank\_WSTWEN=0x08;  
&nbsp;&nbsp;&nbsp; eMI\_InitStruct.EMI\_Bank\_MemWidth=EMI\_Width\_HalfWord;  
&nbsp;&nbsp;&nbsp; EMI\_Init( EMI\_Bank1, &eMI\_InitStruct );

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 18, 2008, 7:34am UTC](https://forums.freertos.org/t/freertos-with-ethernet/2415/4 "2008-12-18T07:34:54Z")

</div>

**[stf12](https://sourceforge.net/u/stf12/)** wrote on [Thursday, December 18, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/636ef82c/#e0d1/4d8b):

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](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
