Hello All... Where can I find the PIN initialisations of Ethernet module in TWRK60N512 BSP and related source code.

cancel
Showing results for 
Search instead for 
Did you mean: 

Hello All... Where can I find the PIN initialisations of Ethernet module in TWRK60N512 BSP and related source code.

Jump to solution
672 Views
chandrasekarkan
Contributor III

I am working on a custom board that has MK60DN512ZVLQ10 uC on it...

Tower board has Ethernet in RM-II interface mode...

Our team mates have interfaced Ethernet in M-II mode which needs PTA-(24-29) to be set in ALT-4 MUX functionality.

I got it working with FNET's TCP stack with the above changes but we really need it work as well as with RTCS stack.

Tools: CW10.2/ Keil & MQX4.0.1 ---- Debugger: PE micro universal Multilink.

regards ...........

  

Labels (1)
1 Solution
284 Views
mjbcswitzerland
Specialist V

Hi

I believe that you need to add additional lines as follows (as well as A24..A29):

_CONFIG_PERIPHERAL(A, 9,  PA_9_MII0_RXD3);                       // MII0_RXD3 on PA.9  (alt. function 4)
_CONFIG_PERIPHERAL(A, 10, PA_10_MII0_RXD1);                      // MII0_RXD1 on PA.10 (alt. function 4)
_CONFIG_PERIPHERAL(A, 11, PA_11_MII0_RXCLK);                     // MII0_RXCLK on PA.11 (alt. function 4)
_CONFIG_PERIPHERAL(A, 24, PA_24_MII0_TXD2);                      // MII0_TXD2 on PA.24 (alt. function 4)
_CONFIG_PERIPHERAL(A, 25, PA_25_MII0_TXCLK);                     // MII0_TXCLK on PA.25 (alt. function 4)
_CONFIG_PERIPHERAL(A, 26, PA_26_MII0_TXD3);                      // MII0_TXD3 on PA.26 (alt. function 4)
_CONFIG_PERIPHERAL(A, 27, PA_27_MII0_CRS);                       // MII0_CRS  on PA.27 (alt. function 4)
_CONFIG_PERIPHERAL(A, 28, PA_28_MII0_TXER);                      // MII0_TXER on PA.28 (alt. function 4)
_CONFIG_PERIPHERAL(A, 29, PA_29_MII0_COL);                       // MII0_COL  on PA.29 (alt. function 4)

I use the following macro for peripheral functions:

#define _CONFIG_PERIPHERAL(port, pin, function) SIM_SCGC5 |= SIM_SCGC5_PORT##port; PORT##port##_PCR##pin = function

where each alternative function 4 is simply 0x00000400 (eg. PA_9_MII0_RXD3 is defined as this).

Regards

Mark

View solution in original post

4 Replies
285 Views
mjbcswitzerland
Specialist V

Hi

I believe that you need to add additional lines as follows (as well as A24..A29):

_CONFIG_PERIPHERAL(A, 9,  PA_9_MII0_RXD3);                       // MII0_RXD3 on PA.9  (alt. function 4)
_CONFIG_PERIPHERAL(A, 10, PA_10_MII0_RXD1);                      // MII0_RXD1 on PA.10 (alt. function 4)
_CONFIG_PERIPHERAL(A, 11, PA_11_MII0_RXCLK);                     // MII0_RXCLK on PA.11 (alt. function 4)
_CONFIG_PERIPHERAL(A, 24, PA_24_MII0_TXD2);                      // MII0_TXD2 on PA.24 (alt. function 4)
_CONFIG_PERIPHERAL(A, 25, PA_25_MII0_TXCLK);                     // MII0_TXCLK on PA.25 (alt. function 4)
_CONFIG_PERIPHERAL(A, 26, PA_26_MII0_TXD3);                      // MII0_TXD3 on PA.26 (alt. function 4)
_CONFIG_PERIPHERAL(A, 27, PA_27_MII0_CRS);                       // MII0_CRS  on PA.27 (alt. function 4)
_CONFIG_PERIPHERAL(A, 28, PA_28_MII0_TXER);                      // MII0_TXER on PA.28 (alt. function 4)
_CONFIG_PERIPHERAL(A, 29, PA_29_MII0_COL);                       // MII0_COL  on PA.29 (alt. function 4)

I use the following macro for peripheral functions:

#define _CONFIG_PERIPHERAL(port, pin, function) SIM_SCGC5 |= SIM_SCGC5_PORT##port; PORT##port##_PCR##pin = function

where each alternative function 4 is simply 0x00000400 (eg. PA_9_MII0_RXD3 is defined as this).

Regards

Mark

284 Views
chandrasekarkan
Contributor III

Thank you Mark

                       I added the following lines in the function "_bsp_enet_io_init" found in "init_gpio.c" file and Ethernet started to work fine....

    pctl->PCR[5]   = 0x00000400; /* PTA5,  RMII0_RXER/MII0_RXER  */
    pctl->PCR[9]   = 0x00000400; /* PTA9,  MII0_RXD3  */
    pctl->PCR[10]  = 0x00000400; /* PTA10, MII0_RXD2  */
    pctl->PCR[11]  = 0x00000400; /* PTA11, MII0_RXCLK */

   

    pctl->PCR[24]  = 0x00000400; /* PTA24, MII0_TXD2  */
    pctl->PCR[25]  = 0x00000400; /* PTA25, MII0_TXCLK */
    pctl->PCR[26]  = 0x00000400; /* PTA26, MII0_TXD3  */
    pctl->PCR[27]  = 0x00000400; /* PTA27, MII0_CRS   */
    pctl->PCR[28]  = 0x00000400; /* PTA28, MII0_TXER  */
    pctl->PCR[29]  = 0x00000400; /* PTA29, MII0_COL   */

Regards

0 Kudos
284 Views
perlam_i_au
Senior Contributor I

Have you try with AN4367 or AN3099? These app notes may could be helpful.

Let me know if you still have problems

284 Views
chandrasekarkan
Contributor III

Thank you Andrea... those documents are helpful... the GPIO pin initialisations are found in "<MqxRootDir>\\mqx\source\bsp\twrk60N512\init_gpio.c"

0 Kudos