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.

BIOS port E_createFailed: mdCreateChan returned error -139

Other Parts Discussed in Thread: SYSBIOS

Hi team,

Customer is porting SPI, I2C, UART drivers from an old project to a new project.

Old project: DSP-BIOS 5.42.01.09, PSP 01.30.01, EDMA 01.11.02.05, XDC 3.22.04.45

New project: SYS-BIOS 6.35.04.50, BIOSPSP 03.00.01.00, EDMA 02.11.11.13, XDC 3.25.03.72
Drivers (SPI, UART, I2C) code we wrote for the old project is using GIO. They've  ported all the code to new environment and made necessary modifications as the signature is changed (e.g. "GIO_create", "GIO_Params" )as shown below.

***********************************
BIOS5 code:
  GIO_Attrs           gioAttrs            = GIO_ATTRS;
  Spi_ChanParams      chanParams;
   EDMA3_DRV_Result    edmaResult      = 0;

   if (NULL == hEdma[0])
   {
       edmaResult = edma3init();
       if (EDMA3_DRV_SOK != edmaResult)
       {
           /* Error in configuring the edma driver                       */
           //LOG_printf(&trace,"\r\nEDMA3 : edma3init() failed\r\n");
       }
       else
       {
           //LOG_printf(&trace,"\r\nEDMA3 : edma3init() passed\r\n");
       }
   }

   chanParams.hEdma = hEdma[0];

   Int32 status;
   /* create SPI channel for transmission */
   spiflashHandle =  GIO_create("/SPI1",IOM_INPUT,&status,&chanParams,&gioAttrs);


BIOS6 code:
  GIO_Params gioParams;
  Error_Block eb;
  Error_init(&eb);
  Spi_ChanParams      chanParams;
   EDMA3_DRV_Result    edmaResult      = 0;

  GIO_Params_init(&gioParams);

   if (NULL == hEdma[0])
   {
       hEdma[0] = edma3init(0, &edmaResult);
       if (EDMA3_DRV_SOK != edmaResult)
       {
           /* Error in configuring the edma driver                       */
           //LOG_printf(&trace,"\r\nEDMA3 : edma3init() failed\r\n");
       }
       else
       {
           //LOG_printf(&trace,"\r\nEDMA3 : edma3init() passed\r\n");
      }
   }

   chanParams.hEdma = hEdma[0];
   gioParams.chanParams = &chanParams;

   spiflashHandle =  GIO_create("/SPI1",GIO_INPUT, &gioParams, &eb);

*************************

Code compile and link fine but get following error when trying to execute above ("GIO_create") line.

SPI Test: EDMA Request failed
SPI Test: EDMA Request failedti.sysbios.io.GIO: line 248: E_createFailed: mdCreateChan returned error -139


Drivers are created using following code in *.cfg file.

var iomFxns = "Uart_IOMFXNS";
var initFxn = "UartInit";
var deviceParams = "uartParams";
var deviceId = 1;
GIO.addDeviceMeta("/UART0", iomFxns, initFxn, deviceId, deviceParams);

var iomFxns = "Spi_IOMFXNS";
var initFxn = "SpiInit";
var deviceParams = "spiParams";
var deviceId = 0;
GIO.addDeviceMeta("/SPI0", iomFxns, initFxn, deviceId, deviceParams);

var iomFxns = "Spi_IOMFXNS";
var initFxn = "SpiFlashInit";
var deviceParams = "spiflashParams";
var deviceId = 1;
GIO.addDeviceMeta("/SPI1", iomFxns, initFxn, deviceId, deviceParams);

var iomFxns = "I2c_IOMFXNS";
var initFxn = "I2cBatteryInit";
var deviceParams = "i2cBatteryParams";
var deviceId = 0;
GIO.addDeviceMeta("/I2C0", iomFxns, initFxn, deviceId, deviceParams);

var iomFxns = "I2c_IOMFXNS";
var initFxn = "I2cInit";
var deviceParams = "i2cParams";
var deviceId = 1;
GIO.addDeviceMeta("/I2C1", iomFxns, initFxn, deviceId, deviceParams);

Worth noting, the customer also has an external E2E presence (http://e2e.ti.com/members/592095/default.aspx) and has had previously inquiries during this porting effort.

Error -139 appears to be an invalid parameter error but the parameters passed to GIO_Create look ok.

Any insight is greatly appreciated. 

  • Hi Michael,

    Which hardware platform are they on?

    First issue I see:

    Michael S said:
    GIO.addDeviceMeta("/SPI0", iomFxns, initFxn, deviceId, deviceParams);

    This API has been deprecated.  You must now use the DEV module to configure your devices.  This is true for BIOS 6.35.04.50 that they are using.  Please refer to the BIOS User's Guide, Input/Output, section 9.2 "Configuring Drivers in the Device Table."

    Next ...

    Michael S said:
           edmaResult = edma3init();
           if (EDMA3_DRV_SOK != edmaResult)
           {
               /* Error in configuring the edma driver                       */
               //LOG_printf(&trace,"\r\nEDMA3 : edma3init() failed\r\n");
           }
           else
           {
               //LOG_printf(&trace,"\r\nEDMA3 : edma3init() passed\r\n");
           }

    Michael S said:
    SPI Test: EDMA Request failed
    SPI Test: EDMA Request failedti.sysbios.io.GIO: line 248: E_createFailed: mdCreateChan returned error -139

    These errors look related to EDMA.  Do you know if the calls to edma3init() succeeded?  If not, it's possible that hEdma[0] is NULL.  The print statements are commented out, so if they failed, it would be good to know.  That could be related to the problem.

    Steve

  • Hello Steve,

    (1) We are using c6748.

    (2) edma3init() is successful.

    (3) We changed device configration code as below (as you have suggested).

     

    ***********************************

    BIOS5 code

    var iomFxns = "Spi_IOMFXNS";

    var initFxn = "SpiInit";

    var deviceParams = "spiParams";

    var deviceId = 0;

    GIO.addDeviceMeta("/SPI0", iomFxns, initFxn, deviceId, deviceParams);

     

    var iomFxns = "Spi_IOMFXNS";

    var initFxn = "SpiFlashInit";

    var deviceParams = "spiflashParams";

    var deviceId = 1;

    GIO.addDeviceMeta("/SPI1", iomFxns, initFxn, deviceId, deviceParams);

    ***********************************

    BIOS6 code

    DEV.tableSize = 2;

     

    var dev0Params = new DEV.Params();

    dev0Params.instance.name = "generator";

    dev0Params.initFxn = "&SpiInit";

    dev0Params.deviceParams = "&spiParams";

    dev0Params.devid = 0;

    Program.global.generator = DEV.create("/SPI0", "&Spi_IOMFXNS", dev0Params);

     

    var dev1Params = new DEV.Params();

    dev1Params.instance.name = "spi_1";

    dev1Params.initFxn = "&SpiFlashInit";

    dev1Params.deviceParams = "&spiflashParams";

    dev1Params.devid = 1;

    Program.global.generator = DEV.create("/SPI1", "&Spi_IOMFXNS", dev1Params);

    ***********************************

    By changing the code, we ran into linker error. We notice that we have following directory as compile include path in project configuration.

    "C:\ti\bios_6_35_04_50\packages\ti\bios\include"

    We have noticed that "dev.h" file in above directory conflicts with SYS-BIOS device. If we remove above directory, the project can't  compile as it can't find "std.h", "tsk.h", "log.h" files.

    Question:  Is it okay to include "C:\ti\bios_6_35_04_50\packages\ti\bios\include" directory in SYS-BIOS project configuration ?

    Thanks

    Jayesh

     

  • Jayesh,

    Are you using the SYS/BIOS legacy support in your app?  E.g. are you still using BIOS 5.x style API calls in your C code?

    If not, then you should check your *.cfg file for a line that looks like the following:

    xdc.loadPackage(‘ti.bios.tconf’)

    If you are not using SYS/BIOS legacy support, then you should remove that line.

    Steve

  • Hello Steve,

    We are not  using SYS/BIOS legacy support in our app. We do not have xdc.loadPackage(‘ti.bios.tconf’) line in *.cfg file.

    Can you please look into following ?

     We changed device configration code as below (as you have suggested).

    ***********************************

    BIOS5 code

    var iomFxns = "Spi_IOMFXNS";

    var initFxn = "SpiInit";

    var deviceParams = "spiParams";

    var deviceId = 0;

    GIO.addDeviceMeta("/SPI0", iomFxns, initFxn, deviceId, deviceParams);


    var iomFxns = "Spi_IOMFXNS";

    var initFxn = "SpiFlashInit";

    var deviceParams = "spiflashParams";

    var deviceId = 1;

    GIO.addDeviceMeta("/SPI1", iomFxns, initFxn, deviceId, deviceParams);

    ***********************************

    BIOS6 code

    DEV.tableSize = 2;

    var dev0Params = new DEV.Params();

    dev0Params.instance.name = "generator";

    dev0Params.initFxn = "&SpiInit";

    dev0Params.deviceParams = "&spiParams";

    dev0Params.devid = 0;

    Program.global.generator = DEV.create("/SPI0", "&Spi_IOMFXNS", dev0Params);

    var dev1Params = new DEV.Params();

    dev1Params.instance.name = "spi_1";

    dev1Params.initFxn = "&SpiFlashInit";

    dev1Params.deviceParams = "&spiflashParams";

    dev1Params.devid = 1;

    Program.global.generator = DEV.create("/SPI1", "&Spi_IOMFXNS", dev1Params);

    ***********************************

    By changing the code, we ran into linker error. We notice that we have following directory as compile include path in project configuration.

    "C:\ti\bios_6_35_04_50\packages\ti\bios\include"

    We have noticed that "dev.h" file in above directory conflicts with SYS-BIOS device. If we remove above directory, the project can't  compile as it can't find "std.h", "tsk.h", "log.h" files.

    Question:  Is it okay to include "C:\ti\bios_6_35_04_50\packages\ti\bios\include" directory in SYS-BIOS project configuration ?

    Thanks

    Jayesh

  • Jayesh,

    Jayesh Patel63136 said:
    Question:  Is it okay to include "C:\ti\bios_6_35_04_50\packages\ti\bios\include" directory in SYS-BIOS project configuration ?

    No, you should not include this.  The ti/bios package is for legacy BIOS support only.  If your app doesn't use legacy code, it should not have any references to the ti.bios package.

    Jayesh Patel63136 said:
    We have noticed that "dev.h" file in above directory conflicts with SYS-BIOS device. If we remove above directory, the project can't  compile as it can't find "std.h", "tsk.h", "log.h" files.

    Yes, you want to avoid such conflicts.

    And why are you getting errors due to legacy files such as tsk.h, etc.?  Those are legacy files.  Are you including those files somewhere?

    If so, then you still have legacy code in your app.  You should change or remove those references.

    Steve