Author Topic: Converting a Teensy4.1 to a MicromodTeensy, Ethernet RMII breaks ethernet sim  (Read 4387 times)

Offline Ray

  • Newbie
  • *
  • Posts: 19
    • View Profile
I found an old link where Paul S confirmed that RMII can be implemented on the MicroModTeensy. 
Most of this was already setup in the uTasker kinetis_ENET.h   

I needed to add a #define ENET2_REF_CLK2_ON_EMC
I added a new #define  ENET2_ON_MICROMOD   (copy/pasted from the default)[/img]
        #elif defined ENET2_ON_MICROMOD
        _CONFIG_PERIPHERAL(GPIO_B0_12, ENET2_TDATA00, (PORT_DSE_MID | PORT_SRE_FAST)); // ENET2_TDATA00 on GPIO2-12 (alt. function 8)
        _CONFIG_PERIPHERAL(GPIO_EMC_31, ENET2_TDATA01, (PORT_DSE_MID | PORT_SRE_FAST)); // ENET2_TDATA01 on GPIO4-31 (alt. function 8)
        _CONFIG_PERIPHERAL(GPIO_EMC_32, ENET2_TX_EN, (PORT_DSE_MID | PORT_SRE_FAST));    //
        IOMUXC_ENET2_IPP_IND_MAC0_RXDATA_SELECT_INPUT_0 = IOMUXC_ENET2_IPP_IND_MAC0_RXDATA_SELECT_INPUT_0_GPIO_SD_B0_03_ALT8;
        _CONFIG_PERIPHERAL(GPIO_SD_B0_03, ENET2_RDATA00, 0);                // ENET2_RX_DATA00 on GPIO2-20 (alt. function 8)
        IOMUXC_ENET2_IPP_IND_MAC0_RXDATA_SELECT_INPUT_1 = IOMUXC_ENET2_IPP_IND_MAC0_RXDATA_SELECT_INPUT_1_GPIO_SD_B0_04_ALT8;
        _CONFIG_PERIPHERAL(GPIO_SD_B0_04, ENET2_RDATA01, 0);                // ENET2_RX_DATA01 on GPIO2-21 (alt. function 8)
        IOMUXC_ENET2_IPP_IND_MAC0_RXERR_SELECT_INPUT = IOMUXC_ENET2_IPP_IND_MAC0_RXERR_SELECT_INPUT_GPIO_B1_00_ALT8; // special case to select the pad involved in daisy chain
        _CONFIG_PERIPHERAL(GPIO_B1_00, ENET2_RX_ER, 0);                  // ENET2_RX_ER on GPIO2-16 (alt. function 8)


The simulator shows the correct peripheral configuration when I define IP_ETHERNET_INTERFACE_COUNT 2
Also created:
        #define ETHERNET_COUNT    2   // because of 2 ETH_CONTROLLERS
        #define ENET2_REF_CLK2_ON_SD
        #define ENET2_ON_MICROMOD

Unfortunately, something is miss-configured because the simulator is showing a red connect light, and ping, nor http is working now that I have made modifications from the original TEENSY4.1   I'm guessing this is probably nothing more than a #define mistake somewhere, I haven't added any code yet.

I attached a bmp of the simulator showing the peripheral configuration while running

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3254
    • View Profile
    • uTasker
Hi Ray

I just checked in basic support of the MicroModTeensy - see image.

Since this module doesn't have Ethernet the external circuit will define how it is connected and details about the PHY so this is presently inherited from the Teensy 4.1 but it looks like yours uses the second Ethernet and not the first (with a few clocking adjustments).

My note are:
1. #define ETHERNET_COUNT    2
is defined in iMX.h and so will automatically be set when the i.MX RT 106x is in use.
2. I didn't check details about the signal connections but the setup can be checked accurately based on the pin functions displayed when the simulation is running and so is probably Ok based on your checks.
3. The simulator doesn't actually use the pin connections for its Ethernet connection and so such details will probably not be able to result in a simulation issue.
4. You may be missing
#define ETH_INTERFACE_CHANNEL     iMX_ENET_2                 // use the second ethernet controller as first interface (1Gb/s if iMX RT 11xx)
if you connect to the second Ethernet interface. This will allow all Ethernet traffic to be on that one and the simulator will also connect to it.
5. If using dual Ethernet the interface count can be set to 2
#define ETH_INTERFACE_COUNT       2                          // enable two ethernet interfaces
When working with the dual Ethernet connection the simulator will need to know which one to connect to or else can use
Code: [Select]
SIMULATE_DUAL_ENET_CONNECTIONwhich will pass all received frames to both Ethernet interfaces, but I don't think that this is relevant in your case.


In case of general issues with receiving date (when the NIC is correctly selected) I recommend setting a break point in fnCheckThisEthernet() in iMxSim.c, which should be hit whenever any Ethernet data is received (either from the connected NIC or else from a script file). You can then check that it is being handled on the correct Ethernet and see whether it is rejected due to a configuration setting, etc.

Regards

Mark



Offline Ray

  • Newbie
  • *
  • Posts: 19
    • View Profile
You were EXACTLY correct.  Somehow, I completely missed this one #define:
#define ETH_INTERFACE_CHANNEL     iMX_ENET_2                 // use the second ethernet controller as first interface (1Gb/s if iMX RT 11xx)

Simulator up and running flawlessly.  All pins appear to be configured correctly.

Thanks!