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.

An error occurred Creating UART_Hwi

Other Parts Discussed in Thread: SYSBIOS

Hi,

I tried all the things to create a hwi for UART of EVM6678 but I failed yet.

From some articles here, I adopted many lines to try it.

Following code is what I tried finally.

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

int UART_init(void)
{
    Hwi_Params UART_Hwi_params;
    Int hostInt, sysInt;
    int eventId;
    Error_Block eb;

//    platform_uart_init();

//    (void) platform_write_configure(PLATFORM_WRITE_ALL);

    hUartRegs->PWREMU_MGMT = 0x0;
    (void) platform_uart_set_baudrate(115200);

    hUartRegs->IER=0x01;
    hUartRegs->MCR = 0;
    hUartRegs->FCR = 0x7;
    hUartRegs->PWREMU_MGMT = 0x6001;

    sysInt = 148;
    hostInt = 32;

    eventId = CpIntc_getEventId(hostInt);

    Hwi_Params_init(&UART_Hwi_params);
    UART_Hwi_params.arg = hostInt;
    UART_Hwi_params.eventId = eventId;
    UART_Hwi_params.enableInt = TRUE;
    UART_Hwi_params.priority = 2;
    UART_Hwi_params.maskSetting = Hwi_MaskingOption_ALL;
    UART_Hwi_Handle = Hwi_create(5, UART_Rx_hwi, &UART_Hwi_params, &eb);
    an_error = Error_getMsg(&eb);

//    platform_write("UART_Hwi_Handle = %d\n",UART_Hwi_Handle);
//    Hwi_enableInterrupt(5);
//    Hwi_enable();

    /*
    * plug CpIntc dispatch table with 'UART_Rx_hwi'.
    * set 'unmask' to 'TRUE' to enable the system interrupt.
    */

    CpIntc_disableHostInt(0, hostInt);
    CpIntc_disableSysInt(0, sysInt);
    CpIntc_clearSysInt(0, sysInt);
    CpIntc_mapSysIntToHostInt(0, sysInt, hostInt);
    CpIntc_dispatchPlug(sysInt, UART_Rx_hwi, sysInt, TRUE);
    CpIntc_enableHostInt(0, hostInt);
    CpIntc_enableSysInt(0, sysInt);

    return 1;
}

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

But when I printed the "an_error" in EVM_init() It was read as.  -- platform_write(an_error);

out of memory: heap=0xb, size=36123

In my .cfg file,

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

var Memory  = xdc.useModule('xdc.runtime.Memory');
var Startup = xdc.useModule('xdc.runtime.Startup');
var BIOS = xdc.useModule('ti.sysbios.BIOS');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
var CpIntc = xdc.useModule('ti.sysbios.family.c66.tci66xx.CpIntc');

Clock.tickPeriod = 2000; 
//in usec

BIOS.heapSize = 65536;


var Task = xdc.useModule('ti.sysbios.knl.Task');


/* Configure the Modules */
BIOS.taskEnabled = true;

/* Create our memory map - i.e. this is equivalent to linker.cmd */
Program.sectMap[".const"] = "DDR3";
Program.sectMap[".text"] = "DDR3";
Program.sectMap[".code"] = "DDR3";
Program.sectMap[".data"] = "DDR3";
Program.sectMap[".sysmem"] = "DDR3";
Program.sectMap["platform_lib"] = "DDR3";

/* Lets register any hooks, tasks, etc that we want BIOS to handle
 ** Register an EVM Init handler with BIOS. This will initialize the   ** hardware.
** BIOS calls before it starts.
*/
Startup.firstFxns.$add('&EVM_init');

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

I call UART_init() in the EVM_init() and it is the first thing in the EVM_init();

What is the meaning of "out of memory: heap=0xb, size=36123"?

and How to fix it?

James

  • James,

    I think what's going on is that you are calling EVM_init() from a first function and its trying to allocate from the heap which hasn't been initialized yet because first function executes before any SYSBIOS modules are initialized. Is there any particular reason why you are doing this in a first functions?

    Can you do it in a last functions or even in main()?

    Judah
  • Judah,

    Thank you for your advice.

    The problem related to heap memory seemed to be fixed.

    When I read your answer I checked the initializtion sequence again and I add the 'last function' into .cfg

    -->  Startup.lastFxns.$add('&EVM_init_last');

    But UART_Hwi is still not created.

    I think it is not a matter of setting CpInt or Intc.

    This time the message of error block does not show anything. :(

    I attacted .zip file of the whole project instead of showing the code snippet. I'm sorry.

    Maybe only led_play_ddr3.cfg and led_play_ddr3.c are needed to understand what's going on.

    Thank you again.

    James

    2287.led_play_ddr3_UART_Hwi_Fail.zip

  • I opened up your project. Why is the target set to 'ti.targets.C64P' and the platform 'ti.platforms.evm3530'?

    These are incorrect for the evm6678 and thus would not run correctly if you try it on an evm6678.
    The target should be 'ti.targets.elf.C66' and the platform should be 'ti.platforms.evm6678'

    Judah
  • Judah,

    I checked the project property again. and there was no problem in RTSC settings.

    Maybe the project file was corrupted when I condense it to  a .zip file.

    UART is OK. and Timer is OK. LED is OK. but only UART_Hwi is not created. :(

    Anyway,

    Thank you.

    James

  • James,

    Sorry, I mistaken another project from the forum for your project. So I looked at your project and the RTSC settings is okay.

    Now, are you saying that you don't see the Hwi being created for UART_Hwi? When I run your .out file, I do see this being created.
    So i'm a bit confused on what the problem is? When I put a breakpoint on UART_init() and I run to there and then I run to main(). Then I open up ROV view and go to the Hwi module, I see in Hwi #5, UART_Rx_hwi created.

    Please clarify what you mean.

    Judah

  • Judah,

    After reading your comment, I powered the EVM and tried again.

    When I saw the ROV, I couldn't find UART_Hwi.

    But I found that a .h file was not linked to the debugger so I linked it and then I found UART_Hwi created.

    Anyway, I also found that the function  UART_Rx_hwi(UArg arg) could be called only once.

    Do you have any experience about it?

    Thank you for your kindness.

    Regards,

    James

  • James,

    I don't have experience with UART on this device.  Perhaps there some acknowledge bit or something that your ISR needs to clear?
    I would suggest making a new post in the Multicore forum about UART specifics.

    But seems like your UART_Hwi being created is now answered?

    Judah

  • Dear Judah.

     

    Yes, my question was answered.

    Thank you very much for your help.

    Because of your test, I could try to debug again with confidence. :)

     

    I should do with another bug.

     

    Thank you again.

     

    James