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/AM3352: NIMU ioctl issue

Part Number: AM3352
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hi Paula.

https://e2e.ti.com/support/arm/sitara_arm/f/791/p/2493623/reply?ReplyToContentTypeID=1

According the Post below , I have modified my code regarding this API: ==>NIMUIoctl

e2e.ti.com/.../reply

However, the API still gives me -22.

Please help to solve.

Thanks.

BR Rio

CCCCCCCC
StarterWare Boot Loader
BOARDInit status [0x0]
SoC : [AM335X]
Core : [A8]
Board Detected : [GPEVM]
Base Board Revision : [UNKNOWN]
Daughter Card Revision: [UNKNOWN]
Copying application image from MMC/SD card to RAM
Jumping to StarterWare Application...

SetPhyMode:000021e1 Auto:1, FD10:64, HD10:32, FD100:256, HD100:128, FD1000:8192 LPBK:0

SYS/BIOS Ethernet/IP (CPSW) Sample application, EVM IP address: 192.168.1.4
SetPhyMode:000021e1 Auto:1, FD10:64, HD10:32, FD100:256, HD100:128, FD1000:8192 LPBK:0

Rio Debug ==> MAC Address error code = -22
ENETPHY_FindingState: PhyNum: 0
ENETPHY_FindingState: Timed Out looking for a Phy!
ENETPHY_DisablePhy(0)
Enable Phy to negotiate external connection
NWAY Advertising: FullDuplex-1000 FullDuplex-100 HalfDuplex-100 FullDuplex-10 HalfDuplex-10
ENETPHY_FindingState: Timed Out looking for a Phy!
ENETPHY_FindingState: Timed Out looking for a Phy!
ENETPHY_FindingState: Timed Out looking for a Phy!
ENETPHY_FindingState: Timed Out looking for a Phy!
ENETPHY_FindingState: Timed Out looking for a Phy!
ENETPHY_FindingState: Timed Out looking for a Phy!
ENETPHY_FindingState: Timed Out looking for a Phy!
ENETPHY_FindingState: Timed Out looking for a Phy!
ENETPHY_FindingState: Timed Out looking for a Phy!

  • Hi Paula:

    I offer more detail information, i'm modifying this project:
    NIMU_FtpExample_evmAM335x_armExampleproject


    My code is here:
    ret_code = NIMUIoctl (NIMU_GET_NUM_NIMU_OBJ, NULL, &num_device, sizeof(num_device));
    if (ret_code <0)
    UART_printf ("\n Rio Debug ==> NIMU_GET_NUM_NIMU_OBJ error code = %d \n", ret_code);
    else
    UART_printf ("\n Rio Debug ==> MAC NIMU_GET_NUM_NIMU_OBJ num_device = %d\n", num_device);

    /* Allocate memory for the device table*/
    dev_table = mmAlloc(num_device * sizeof(UINT16));


    /* Get a list of all device index. */
    ret_code = NIMUIoctl (NIMU_GET_ALL_INDEX, NULL, dev_table, num_device*sizeof(UINT16));
    if (ret_code <0)
    UART_printf ("\n Rio Debug ==> NIMU_GET_ALL_INDEX error code = %d \n", ret_code);

    if_req.index = dev_table[0];

    ret_code = NIMUIoctl (NIMU_GET_DEVICE_MAC, &if_req, &mac_address, sizeof(mac_address));

    #endif
    if (ret_code <0)
    UART_printf ("\n Rio Debug ==> MAC Address error code = %d \n", ret_code);
    else
    UART_printf ("\n Rio Debug ==> MAC Address : 0x%x-0x%x-0x%x-0x%x-0x%x-0x%x\n\n\n",
    mac_address[0], mac_address[1], mac_address[2],
    mac_address[3], mac_address[4], mac_address[5]);
    #endif





    -------------------------------------------------------------------------------------
    No matter what I call, it returns -22.

    SetPhyMode:000021e1 Auto:1, FD10:64, HD10:32, FD100:256, HD100:128, FD1000:8192 LPBK:0

    SYS/BIOS Ethernet/IP (CPSW) Sample application, EVM IP address: 192.168.1.4
    SetPhyMode:000021e1 Auto:1, FD10:64, HD10:32, FD100:256, HD100:128, FD1000:8192 LPBK:0

    Rio Debug ==> NIMU_GET_NUM_NIMU_OBJ error code = -22

    Rio Debug ==> NIMU_GET_ALL_INDEX error code = -22


    -------------------------------------------------------------------------------------



    This is my cfg, I never change it.

    /*******************************************************************************
    * *
    * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com/ *
    * ALL RIGHTS RESERVED *
    * *
    ******************************************************************************/

    /*******************************************************************************
    * file name: nimu_evm.cfg
    * This file is included in the ethernet switch example
    *
    *******************************************************************************/

    /* ================ General configuration ================ */

    var enableStaticIP = 1;

    var Defaults = xdc.useModule('xdc.runtime.Defaults');
    var Diags = xdc.useModule('xdc.runtime.Diags');
    var Error = xdc.useModule('xdc.runtime.Error');
    var Main = xdc.useModule('xdc.runtime.Main');
    var Memory = xdc.useModule('xdc.runtime.Memory')
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    var System = xdc.useModule('xdc.runtime.System');
    var Text = xdc.useModule('xdc.runtime.Text');
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    var Task = xdc.useModule('ti.sysbios.knl.Task');
    var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
    var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
    var Timer = xdc.useModule('ti.sysbios.hal.Timer');
    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    var SemihostSupport = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');

    /*
    * Program.argSize sets the size of the .args section.
    * The examples don't use command line args so argSize is set to 0.
    */
    Program.argSize = 0x0;

    /* System stack size (used by ISRs and Swis) */
    Program.stack = 0x10000;

    /*
    * Uncomment this line to globally disable Asserts.
    * All modules inherit the default from the 'Defaults' module. You
    * can override these defaults on a per-module basis using Module.common$.
    * Disabling Asserts will save code space and improve runtime performance.
    Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
    */
    Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;

    /*
    * Uncomment this line to keep module names from being loaded on the target.
    * The module name strings are placed in the .const section. Setting this
    * parameter to false will save space in the .const section. Error and
    * Assert messages will contain an "unknown module" prefix instead
    * of the actual module name.
    Defaults.common$.namedModule = false;
    */
    Defaults.common$.namedModule = false;

    /*
    * Minimize exit handler array in System. The System module includes
    * an array of functions that are registered with System_atexit() to be
    * called by System_exit().
    */
    System.maxAtexitHandlers = 4;

    /*
    * Uncomment this line to disable the Error print function.
    * We lose error information when this is disabled since the errors are
    * not printed. Disabling the raiseHook will save some code space if
    * your app is not using System_printf() since the Error_print() function
    * calls System_printf().
    Error.raiseHook = null;
    */
    Error.raiseHook = null;
    /*
    * Uncomment this line to keep Error, Assert, and Log strings from being
    * loaded on the target. These strings are placed in the .const section.
    * Setting this parameter to false will save space in the .const section.
    * Error, Assert and Log message will print raw ids and args instead of
    * a formatted message.
    Text.isLoaded = false;
    */
    Text.isLoaded = false;
    /*
    * Uncomment this line to disable the output of characters by SysMin
    * when the program exits. SysMin writes characters to a circular buffer.
    * This buffer can be viewed using the SysMin Output view in ROV.
    */
    SysMin.flushAtExit = false;

    /* Circular buffer size for System_printf() */
    SysMin.bufSize = 0x200;

    System.SupportProxy = SysMin;

    Clock.tickPeriod = 500;
    var Global = xdc.useModule('ti.ndk.config.Global');
    var Ip = xdc.useModule('ti.ndk.config.Ip');

    Global.netSchedulerPri = Global.NC_PRIORITY_HIGH;
    Global.debugAbortLevel = Global.DBG_ERROR;
    Global.debugPrintLevel = Global.DBG_NONE;

    var ti_sysbios_hal_Timer = xdc.useModule('ti.sysbios.hal.Timer');

    /* Global.stackThreadUser = "&NDKACD_stackThread"; */

    var Tcp = xdc.useModule('ti.ndk.config.Tcp');
    var Udp = xdc.useModule('ti.ndk.config.Udp');

    if (enableStaticIP)
    {
    /* Settings for static IP configuration */
    Ip.ResolveIP = false;
    Ip.CallByIP = false;
    Ip.autoIp = false;
    Ip.address = "192.168.1.4";
    Ip.mask = "255.255.255.0";
    Ip.gatewayIpAddr = "192.168.1.1";
    }
    else
    {
    Ip.dhcpClientMode = Ip.CIS_FLG_IFIDXVALID;
    }

    Global.ndkTickPeriod = 200;
    Global.kernTaskPriLevel = 11;
    Global.serviceReportHook = null;
    Global.IPv6 = false;
    Global.pktNumFrameBufs=384;

    Tcp.transmitBufSize = 16384;
    Tcp.receiveBufSize = 65536;
    Tcp.receiveBufLimit = 65536;


    Program.sectMap[".c_int00"] = new Program.SectionSpec();
    Program.sectMap[".c_int00"].loadAddress = 0x80000000;

    /* ================ BIOS configuration ================ */

    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    BIOS.libType = BIOS.LibType_Custom;
    BIOS.customCCOpts = BIOS.customCCOpts.replace(" -g ","");
    BIOS.assertsEnabled = false;
    BIOS.logsEnabled = false;
    BIOS.swiEnabled = true;

    /*
    * The BIOS module will create the default heap for the system.
    * Specify the size of this default heap.
    */
    BIOS.heapSize = 0x155000;

    Task.defaultStackSize = 4096;
    Task.idleTaskStackSize = 4096;

    /* ================ Driver configuration ================ */
    var socType = "am335x";
    /*use CSL package*/
    var Csl = xdc.loadPackage('ti.csl');
    Csl.Settings.deviceType = socType;

    /* Load the OSAL package */
    var osType = "tirtos"
    var Osal = xdc.useModule('ti.osal.Settings');
    Osal.osType = osType;

    /* Load the board package */
    var Board = xdc.loadPackage('ti.board');
    Board.Settings.boardName = "evmAM335x";
    /* Load the uart package */
    var UartPackage = xdc.loadPackage('ti.drv.uart');


    /* Load the uart package */
    var I2cPackage = xdc.loadPackage('ti.drv.i2c');

    /* Load the uart package */
    var GpioPackage = xdc.loadPackage('ti.drv.gpio');


    /* Load the emac package */
    var Emac = xdc.loadPackage('ti.drv.emac');
    Emac.Settings.socType = socType;

    /* Load the NIMU package */
    var Nimu = xdc.loadPackage('ti.transport.ndk.nimu');
    Nimu.Settings.socType = socType;


    /* ================ Cache and MMU configuration ================ */

    var Cache = xdc.useModule('ti.sysbios.family.arm.a8.Cache');
    Cache.enableCache = true;

    var Mmu = xdc.useModule('ti.sysbios.family.arm.a8.Mmu');
    Mmu.enableMMU = true;

    /* Force peripheral section to be NON cacheable strongly-ordered memory */
    var peripheralAttrs = {
    type : Mmu.FirstLevelDesc_SECTION, // SECTION descriptor
    tex: 0,
    bufferable : false, // bufferable
    cacheable : false, // cacheable
    shareable : false, // shareable
    noexecute : true, // not executable
    };

    /* Define the base address of the 1 Meg page the peripheral resides in. */
    var peripheralBaseAddr = 0x40300000;

    /* Configure the corresponding MMU page descriptor accordingly */
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
    peripheralBaseAddr,
    peripheralAttrs);


    /* Define the base address of the 1 Meg page the peripheral resides in. */
    var peripheralBaseAddr = 0x44e00000;

    /* Configure the corresponding MMU page descriptor accordingly */
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
    peripheralBaseAddr,
    peripheralAttrs);


    /* Define the base address of the 1 Meg page the peripheral resides in. */
    var peripheralBaseAddr = 0x48000000;

    /* Configure the corresponding MMU page descriptor accordingly */
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
    peripheralBaseAddr,
    peripheralAttrs);


    /* Define the base address of the 1 Meg page the peripheral resides in. */
    var peripheralBaseAddr = 0x48100000;

    /* Configure the corresponding MMU page descriptor accordingly */
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
    peripheralBaseAddr,
    peripheralAttrs);


    /* Define the base address of the 1 Meg page the peripheral resides in. */
    var peripheralBaseAddr = 0x48200000;

    /* Configure the corresponding MMU page descriptor accordingly */
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
    peripheralBaseAddr,
    peripheralAttrs);


    /* Define the base address of the 1 Meg page the peripheral resides in. */
    var peripheralBaseAddr = 0x48300000;

    /* Configure the corresponding MMU page descriptor accordingly */
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
    peripheralBaseAddr,
    peripheralAttrs);


    /* Define the base address of the 1 Meg page the peripheral resides in. */
    var peripheralBaseAddr = 0x49000000;

    /* Configure the corresponding MMU page descriptor accordingly */
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
    peripheralBaseAddr,
    peripheralAttrs);


    /* Define the base address of the 1 Meg page the peripheral resides in. */
    var peripheralBaseAddr = 0x4a100000;

    /* Configure the corresponding MMU page descriptor accordingly */
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
    peripheralBaseAddr,
    peripheralAttrs);


    /* Define the base address of the 1 Meg page the peripheral resides in. */
    var peripheralBaseAddr = 0x4a300000;

    /* Configure the corresponding MMU page descriptor accordingly */
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
    peripheralBaseAddr,
    peripheralAttrs);
  • The RTOS team have been notified. They will respond here.
  • Hi Rio, few questions, to see if I can reproduce in my side. Which board are you using? a TI board or a custom board? also could you please point me from where did you get NIMU ftp example?  Final, question, you mention your application is Ethernet/IP, is this your using your own stack running on CPSW? or are you using PRU-ICSS Ethernet/IP? I believe is the first option, but want to confirm.

    thank you,

    Paula

  • Hi Rio, please let us know if you fix the issue and we can close this thread or if you need any additional assistance.

    thank you,
    Paula