This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to access MDIO

Other Parts Discussed in Thread: SYSBIOS, AM3359

Equipment
phyCore_AM335x board
CCSv6 vs 6.1.0.00104
XDS560v2 USB Emulator,
Windows 7, 64-bit, Service Pack 1
am335x_sysbios_ind_sdk_1.1.0.6
Compiler TI v5.2.4
PRU Compiler Tools 2.1.1
SYSBIOS(Target Content) 6.40.3.39


Hi,

the board I am using has a transceiver LAN8710ai connected to the processor AM3359.
Now I would like to disable the transceiver to use some of the pins as GPIOs instead.

Therefore I would like to write to the BASIC CONTROL REGISTER of the transceiver to set the ISOLATE bit or the POWER DOWN bit.

The problem is that when HWREG tries to write to the MDIO_CONTROL register the debugger stops and reports
either 'No source available for "0x8003c010"'
or it goes to the function loader_exit() which is called in the abort() function


At first I thought that the memory is not available, but the .gel-file contains these lines:

GEL_MapOff();
GEL_MapReset();
...
...
GEL_MapAddStr(0x80000000, 0, 0x20000000, "R|W", 0); // 512MB
GEL_MapOn();

So it should be there.
Also writing to 0x8003c010 in the Memory Browser is possible.

The code I used is
    MDIOInit(0x4A101000, 50000000, 1000000); // 0x4A101000 is the base address of the MDIO registers

with
    void MDIOInit(unsigned int baseAddr, unsigned int mdioInputFreq,
    unsigned int mdioOutputFreq)
    {
    unsigned int clkDiv = (mdioInputFreq/mdioOutputFreq) - 1;

    HWREG(baseAddr + MDIO_CONTROL) = ((clkDiv & MDIO_CONTROL_CLKDIV)
        | MDIO_CONTROL_ENABLE
        | MDIO_CONTROL_PREAMBLE
        | MDIO_CONTROL_FAULTENB);
    }

The last assembly instructiob of HWREG is
      E580C004 STR R12, [R0, #4]
where R12 = 0x40140031
shall be stored to address 0x4A101000+4.
This instruction is still reached.

But then the error shows up.

Does anybody have an idea what the reason might be for this behaviour?

Thank you.

Regards,
Martin H.

  • Martin,
    Does the problem occur when you single step the code? Sounds like it does, if so
    is there a MMU in the system? Maybe this address is not mapped into any of the MMU entries?
    Judah
  • Hi Judah,

    thank you for taking care of this.

    The entry in applMmuentries[] that is closest to the MDIO registers basic address is
    ...
    {(void*)0x4A100000,0},
    ...
    I am not familiar with MMU settings and don't know which memory range is covered with that setting.
    So I added the following lines (one line per test, with 0x4A101000 being the MDIO basic registers address)

    {(void*)0x4A101000,1},                  //SYS_MMU_BUFFERABLE
    or {(void*)0x4A100000,2},              // SYS_MMU_CACHEABLE
    or {(void*)0x4A100000,3},

    The result was that

    HWREG(baseAddr + MDIO_CONTROL) = ((clkDiv & MDIO_CONTROL_CLKDIV)
       | MDIO_CONTROL_ENABLE
       | MDIO_CONTROL_PREAMBLE
       | MDIO_CONTROL_FAULTENB);

    worked for each test case, but reading back the register with
               ui2 = HWREG(baseAddr + MDIO_CONTROL);
    did not ("No source available for "0x80038810" ).

    Does that make any sense?
    How do you feel about the MMU entries above?

    Thank you.

    Regards,
    Martin H.

  • Martin,

    Its not clear to me whether you are using SYSBIOS to program the MMU entries or not but we do have SYSBIOS support for the MMU on this device. Furthermore, if you are familiar with the ROV tool, you can check your program at runtime while its halted, what MMU entries are in the system.
    The MMU module can be found: ti/sysbios/family/arm/a8/Mmu

    Judah

  • Judah,

    I am afraid I will have to delay the solution of the problem.
    Unsoldering some resistors will provide the expected result and doing so will save me some time.
    (Though I feel it is not the smart way.)

    Thanks for your support.

    Regards,

    Martin H.