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.

RTOS/PROCESSOR-SDK-AM335X: NIMU basic example issue

Part Number: PROCESSOR-SDK-AM335X

Tool/software: TI-RTOS

I have this problem: Unhandled ADP_Stopped exception 0x20023, and found this:

e2e.ti.com/.../2191411

Like the thread, mine is also virtually right out of the box.  It's the project "NIMU_BasicExample_bbbAM335x_armExampleproject".  (And typically, his questions was never answered)

All I did was alter the CFG file from 

var enableStaticIP         = 1;

to

var enableStaticIP         = 0;

And added a function callback for when the IP was assigned. Of course I had to correct errors in the code where it contained superflous arguments in places like 

 System_printf("\n\rBIOS Task Start\n\r", LocalIPAddr);

After running a bit, it traps with the error.  I assume it is occurring when the DHCP assignment happens.  But I can't figure out what's going on.

What is this error?  Invalid instruction address?  Memory access?  Clock Module not enabled?  If I knew where to look for the meaning, at least I could start debugging.

-CSW

    • EVM Hardware used for the debug ??

      JTAG XDS 100V2  (also called a "BlackHawk, although it isn't)

    • Host Environment Linux or Windows ??

      Windows 7 Pro

    • Processor SDK RTOS version ??

    Either the newer PDK 4.0.0.4, or NDK 2.25.01.11

    • Code composer Studio version ??

    CCS 7.2

    But all I want to know is what is an exception 0x20023 to the AM335x processor?

  • But, lets dig deep into this example, and compare it to the documentation, spru523, spru524, and sprufp2b which I have read cover-to-cover.

    (These are in "main.c" of  "NIMU_BasicExample_bbbAM335x_armExampleproject" right out of the examples)

    Line 130 of the example is

     SOCCtrlCpswPortMacModeSelect(1, ETHERNET_MAC_TYPE_MII);

    Which is not documented anywhere in any of the documents I listed.  What is it? what does it do?

    Lines 135+ contain

    EMAC_socGetInitCfg(0, &cfg);
    ...
    EMAC_socSetInitCfg(0, &cfg);

    Which is also not documented anywhere in the above documents I listed.  These functions are not defined in the example, they are buried deep in the NDK libraries. (Press F3 and it takes you to a header prototype down in the packages - which the PDK fails to built by the way, so I can't rebuild it, I'm stuck with it as-is, a problem I posted on another thread which didn't get solved.)

    Next, there is this at line 147:

        NIMUDeviceTable[nimu_device_index++].init =  &CpswEmacInit ;
        NIMUDeviceTable[nimu_device_index].init =  NULL ;

    What is the NIMUDeviceTable?   Is isn't documented anywhere in the above documents.  And what is the function "CpswEmacInit()" ?  It also is not documented anywhere in the above docs.

    Yes, I have tried searches.  Everywhere I can think of.  In PDFs.  In Wiki's.  In Google...  No real API document which defines what these are.

    So, what I have are a bunch of "spru" documents which have no similarity to an example project, and an example that uses a collection library functions which have no documented descriptions or details anywhere in the NDK documents.

    So, apparently, RTFM is useless...

    Am I the only person who sees a problem with the eco-system?

    -CSW

  • Hi Chris,

    >>After running a bit, it traps with the error.
    Were you able to get the IP address assigned by DHCP server after you disable static IP and before the exception? Does your DHPC configure look like below?

    CI_SERVICE_DHCPC dhcpc;
    // Specify DHCP Service on IF-1
    bzero( &dhcpc, sizeof(dhcpc) );
    dhcpc.cisargs.Mode = CIS_FLG_IFIDXVALID;
    dhcpc.cisargs.IfIdx = 1;
    dhcpc.param.pOptions = DHCP_OPTIONS;
    dhcpc.param.len = 2;
    CfgAddEntry( hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_DHCPCLIENT, 0,
    sizeof(dhcpc), (UINT8 *)&dhcpc, 0 );

    I will file a documentation bug internally. The source code might help understand these functions in the EMAC driver and NDK.

    SOCCtrlCpswPortMacModeSelect ( ) - see PDK packages\ti\starterware\soc\am335x\am335x_control.c, which configures the GMII_SEL register:
    HW_SET_FIELD(regVal, CONTROL_GMII_SEL_GMII1_SEL, 0U);
    HW_SET_FIELD(regVal, CONTROL_GMII_SEL_RGMII1_IDMODE, 0U);
    HW_SET_FIELD(regVal, CONTROL_GMII_SEL_RMII1_IO_CLK_EN, 0U);

    EMAC_socGetInitCfg() - see PDK packages\ti\drv\emac\soc\am335x\emac_soc.c, which gets the SoC level of EMAC intial configuration
    *cfg = EMACInitCfg[port_num];

    NIMUDeviceTable() - see NDK packages\ti\ndk\inc\stack\inc\nimuif.h. The NIMUDeviceTable is a NULL terminated array of driver initialization functions.

    CpswEmacInit - see PDK packages\ti\transport\ndk\nimu\src\v4\cpsw_nimu_eth.c. The function is used to initialize and register the EMAC with the Network Interface Management Unit (NIMU).

    Regards,
    Garrett
  • Chris,
    It appears we are trying to do similar things and running into a lot of very similar roadblocks/lack of documentation. So you are not alone.

    Anyway, check out this post that I ended up solving myself because I was getting very similar exception errors and it was all related to the MMU settings. Maybe you already have this handled but it solved some of my issues trying to bring in different examples into one project. For some reason the example programs do not have all the MMU mapped for enabling the peripherals so you have to check that they are all there or you will run into problems.

    e2e.ti.com/.../664242

    I will also add that if you are building code so your target boots off the SD card (or other method, just not loading the code with Jtag), I found that any fprints in my code locks up the software and makes it crash.

    Alex
  • Alex,
    Thanks. I've got it solved. This was two months ago, and I don't even remember which problem this was, because I've had a bunch more.
    In then end, I've imported the entire NDK into a project, and rebuilt it with the code of whatever I'm working on. So now I can see what the functions are doing, and some of the comments in the code are actually useful.

    For MMU access, I wrote a function that actually goes and gets the MMU table base address, modifies the appropriate table entry location, then re-applies the table to the CP15 registers. Talk about getting a master degree in understanding the ARM architecture!

    As for Booting from an SD card, that is also a problem. But what I'm trying to do is get it to work on a project build with the TI compiler. And, again, like most of the stuff in this eco-system, it doesn't work... right out of the box. An absolutely tiny little "blink the led" project, with some starterware source code to give me GPIO functions won't load or run. And I'm convinced it's because of the tools are not setting the entry point to the correct location, for the MLO and APP files on a card.

    It works with the GNU compiler. So it's not *MY* code. It's the tools that do this restructuring. But support is minuscule as usual. And other priorities have taken my time. I will likely be digging back into that after a week or two.