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.

AMIC110: UART configuration problem

Part Number: AMIC110
Other Parts Discussed in Thread: TMDXICE110

Hi,

I am using AMIC110, configured as EtherCAT Slave, full stack generated by SSC Tool.

Now I need to enable UART and need to recieve data though UART. what ever the data i receive through UART should be loaded on to the Ethercat Frame.

But the problem is when i configure UART With below configuration the program is getting stuck at UART_open(...) function, why?

Is there any thing i have did wrong? what else i need to do?

Can u share me the sequence of steps i need to take care to configure UART.......

//***********************************************************************************************************************//

 #define UART_INSTANCE 0

UART_HwAttrs uart_cfg;
Board_init(BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_MODULE_CLOCK | BOARD_INIT_ICSS_PINMUX | BOARD_INIT_UART_STDIO);

UART_socGetInitCfg(UART_INSTANCE, &uart_cfg);
UART_socSetInitCfg(UART_INSTANCE, &uart_cfg);


UART_init();
Board_setDigOutput(0x20);

params.baudRate = 115200;
params.writeDataMode = UART_DATA_BINARY;
params.readDataMode = UART_DATA_BINARY;
params.readReturnMode = UART_RETURN_FULL;
params.readEcho = UART_ECHO_OFF;

UART_Params_init(&params);
handle = UART_open(UART_INSTANCE, &params);    // Stuck here...
if (!handle) {
//System_printf("UART did not open");
}
const unsigned char hello[] = "Hello World\n";
int32_t ret;
ret = UART_write(handle, hello, sizeof(hello)); //..

//*********************************************************************************************************************//

Please reply as soon as possible....

  • Hi Pavel,

    Thanks for your reply.

    I have gone through the posts you have shared before itself, 

    But I didn't find any solution for my problem.

    Can you see my code i have pasted above and let me know what's the problem with my code?

  • Hi Pavel,

    I am waiting for you response, Please reply as soon as possible.

    Regards,

    Gupta.

  • Gupta,

    Do you use TMDXICE110 board or AMIC110 custom board?

    Do you use PDK 1.0.16?

    Do you have this code from some example/test inside PDK or this is your own code?


    Make sure you have cfg file where you need to setup base addresses, stack size, heap size, MMU setup.

    Check if your uart_cfg.baseAddr is 0x44E09000 (SOC_UART_0_REGS)

    Check also if you have the correct values in below UART0 register:

    CM_WKUP_UART0_CLKCTRL

    Regards,
    pavel

  • Hi Pavel

    1. Do you use TMDXICE110 board or AMIC110 custom board?

    I use TDMXICE110 board, I have configured this board as a EtherCAT Slave, with full stack from Beckhoff SSC tool. Now i need to configure UART also in this Stack. But the Code is Getting stuck at UART_open(), as i have mentioned in the first post.

    2.Do you use PDK 1.0.16?

    no, I am using PDK 1.0.12

    3. Do you have this code from some example/test inside PDK or this is your own code?

    By seeing example code, I customised the code like this.

    4. Make sure you have cfg file where you need to setup base addresses, stack size, heap size, MMU setup.

    where is the cfg file located? 

    5. Check if your uart_cfg.baseAddr is 0x44E09000 (SOC_UART_0_REGS)

    yes, the base address is correct for SOC_UART_0_REGS

    6. Check also if you have the correct values in below UART0 register:

    CM_WKUP_UART0_CLKCTRL

    How to do this?

    Regards,

    Gupta

  • Gupta V V said:

    2.Do you use PDK 1.0.16?

    no, I am using PDK 1.0.12

    Can you test with the latest PDK 1.0.16?

    http://software-dl.ti.com/processor-sdk-rtos/esd/AM335X/latest/index_FDS.html

    Gupta V V said:

    4. Make sure you have cfg file where you need to setup base addresses, stack size, heap size, MMU setup.

    where is the cfg file located? 

    cfg file is located at:

    pdk_am335x_1_0_16/packages/ti/drv/uart/test/am335x/armv7/bios/am335x_app_iceamic110.cfg

    The other iceAMIC110 UART test related files are:

    pdk_am335x_1_0_16/packages/ti/drv/uart/test/am335x/armv7/bios/UART_BasicExample_iceAMIC110_armTestProject.txt

    pdk_am335x_1_0_16/packages/ti/drv/uart/soc/am335x/UART_soc.c

    pdk_am335x_1_0_16/packages/ti/drv/uart/test/src/main_uart_test.c


    Gupta V V said:

    5. Check if your uart_cfg.baseAddr is 0x44E09000 (SOC_UART_0_REGS)

    Check also if you have the correct values in below UART0 register:

    CM_WKUP_UART0_CLKCTRL

    How to do all this?

    You need to put a HW breakpoint at the UART_open() line of your C code. Then you can explore these parameters (uart_cfg.baseAddr, CM_WKUP_UART0_CLKCTRL) at CCS debug windows

    Regards,
    pavel

  • Hi pavel,

    1. Can you test with the latest PDK 1.0.16?

    http://software-dl.ti.com/processor-sdk-rtos/esd/AM335X/latest/index_FDS.html

     I have downloaded the latest pdk file from the above link, Kindly guide me now how to replace the old pdk with the latest one, without causing problem to the project, because we have done so many changes for the project.

    2. cfg file is located at:

    pdk_am335x_1_0_16/packages/ti/drv/uart/test/am335x/armv7/bios/am335x_app_iceamic110.cfg

    this is my cfg file, check it, and let me know any corrections are required.

    Debugging I have to try and let you know about that.

    One more thing is -DDISABLE_UART_PRINT is defined in Make file, Is because of this all UART related functions are not working or it wont bother my code?  

  • Hi Pavel,

    I have tested with  PDK 1.0.16 also now, But still not working, Now I am getting new error.

    c:/ti/ccsv7/tools/compiler/gcc-arm-none-eabi-6-2017-q1-update/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe: ethercat_slave_full_AMIC11x_arm.out section `.rodata' will not fit in region `SRAM_HI1'
    c:/ti/ccsv7/tools/compiler/gcc-arm-none-eabi-6-2017-q1-update/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe: section .eeprom_data1 VMA [4030f3f8,4030f3ff] overlaps section .rodata VMA [4030ea68,40310017]
    c:/ti/ccsv7/tools/compiler/gcc-arm-none-eabi-6-2017-q1-update/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe: region `SRAM_HI1' overflowed by 10684 bytes
    collect2.exe: error: ld returned 1 exit status
    gmake[1]: *** [ethercat_slave_full_AMIC11x_arm.out] Error 1
    makefile:191: recipe for target 'all' failed
    gmake: *** [all] Error 2


    what is this error? How to remove this? What should i do now?

    Please respond soon....

    Regards,

    Gupta.

  • Gupta,

    Gupta V V said:
    I have tested with  PDK 1.0.16

    AM335x/AMIC110 PDK 1.0.16 should be used with:

     - GNU ARM Embedded 7-2018-q2, gcc-arm-none-eabi-7-2018-q2-update

    - CCS v9.1.0

    http://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_release_specific.html

    Regards,
    Pavel

  • Pavel,

    I am using CCS v7

  • Gupta,

    AM335x/AMIC110 PDK 1.0.16 can NOT be used with CCS v7

    Regards,
    Pavel

  • Pavel,

    I have Installed ccsv9.1.0, but now i am getting new errors..

    makefile:195: recipe for target 'ethercat_slave_full_AMIC11x_arm.out' failed
    c:/ti/ccsv9/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: error: ethercat_slave_full_AMIC11x_arm.out uses VFP register arguments, c:/ti/ccsv9/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/thumb\libgcc.a(_udivmoddi4.o) does not
    c:/ti/ccsv9/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccsv9/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/thumb\libgcc.a(_udivmoddi4.o)
    collect2.exe: error: ld returned 1 exit status
    gmake[1]: *** [ethercat_slave_full_AMIC11x_arm.out] Error 1
    gmake: *** [all] Error 2
    makefile:191: recipe for target 'all' failed

    Now what should i do?

  • HI Frank,

    Thanks for your reply.

    all the settings of the compiler are as per they have mentioned in that post that you have shared me, 

    Now i am using PDK 1.0.16 and CCS v 9.1.0, as suggested by Pavel from TI, 

    when i used previous PDK 1.0.12 and CCS v 7 i didnt get this errors, But at that time UART didnt work. so when i 

    asked them for the solution the said to upgrade to PDK 1.0.16 and CCS v 9.1.0. but now i am getting this problem when 

    i am compiling the plain stack also with out UART.

    Do you have any other solution for this?

    I want UART to work along with the ethercat slave stack on AMIC110. 

  • Hi Gupta,

    I don't know why the compiler is throwing this error. I assume the CCS 9.1.0 version of GCC is the one recommended in the PRSDK 6.1.0.8 release? 

    You can either (1) figure out why the stack fails to build using the new GCC, or (2) try to get the UART working with older PRSDK (PDK) + CCS.

    In case you prefer #1: maybe do a web search on "uses VFP register arguments", and play with with the CCS project FPU settings to get past the linker error.

    In case you prefer #2http://software-dl.ti.com/processor-sdk-rtos/esd/AM335X/05_01_00_11/index_FDS.html. I suggest using the recommended CCS version (8.1.0) in this case. Next, build the UART LLD in debug mode and step into UART_open() to see where the failure occurs.

    Regards,
    Frank

  • Hi Frank,

    I Preferred #2 solution of yours, since I have tried somany web cites for that error, but no relevant information that could solve it.

    The older version of ccs and sdk are able to build the stack with out errors, but when I have added UART cofiguration its not building,

    i am getting the following error, i think you will definetly have a solution for this error.

    makefile:192: recipe for target 'ethercat_slave_full_AMIC11x_arm.out' failed
    c:/ti/gcc-arm-none-eabi-6-2017-q1-update/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe: ethercat_slave_full_AMIC11x_arm.out section `.data' will not fit in region `SRAM_HI1'
    c:/ti/gcc-arm-none-eabi-6-2017-q1-update/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe: section .eeprom_data1 VMA [4030f3f8,4030f3ff] overlaps section .data VMA [4030ec48,403103ab]
    c:/ti/gcc-arm-none-eabi-6-2017-q1-update/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe: region `SRAM_HI1' overflowed by 4020 bytes
    collect2.exe: error: ld returned 1 exit status
    gmake[1]: *** [ethercat_slave_full_AMIC11x_arm.out] Error 1
    gmake: *** [all] Error 2
    makefile:188: recipe for target 'all' failed

    Please suggest me a solution for this as soon as possible...

    regards, 

    Gupta

  • Gupta

    It appears adding the UART code increased the size of the GCC generated .data section. This is a linker error indicating your .data section doesn't fit in the memory region SRAM_HI1. I suggest comparing the generated .map files from before and after the UART code to see how .data increased in size.

    There are various options for dealing with this situation, a couple of which include:

    • Increase the size of the SRAM_HI1 memory region. This will required an update to your xdc platform definition or your GCC linker command file, depending on which you're using to define your memory regions.
    • Reduce the size of the .data section by moving some of the generated code to a "dummy section", and then linking this dummy section to another memory region.

    Another idea is to create an independent UART project (using PRSDK + CCS version you've selected) as an intermediate step. Get that working (e.g. in external loopback mode), and then concern yourself with integrating the UART code with the stack.

    I suggest reading up on GCC linker command syntax. There are also numerous GCC linker command files in PRSDK.

    Regards,
    Frank

  • Hi Frank,

    can you please explain me how I can do the below option you have given, in detail step wise, I tried remaining options but no use. 

    Increase the size of the SRAM_HI1 memory region. This will required an update to your xdc platform definition or your GCC linker command file, depending on which you're using to define your memory regions. 

    Reduce the size of the .data section by moving some of the generated code to a "dummy section", and then linking this dummy section to another memory region.

     

    Regards

    Gupta

  • Gupta,

    Where is the SRAM_HI1 memory region defined by your software? Your code is compiled using a CCS project, correct? Are you using a linker command file in the CCS project, or is the linker command file being auto-generated during project compilation?

    What does the linker execution look like on the command line?

  • Hi,

    Where is the SRAM_HI1 memory region defined by your software?

    MEMORY
    {
    SRAM_LO (RWX) : org = 0x402f0000, len = 0x400
    SRAM_HI0 (RWX) : org = 0x402f0400, len = 0x5500 /* .bss */
    SRAM_HI1 (RWX) : org = 0x402f5900, len = 0x19AF8 /* .text ... ARM.exid */
    SRAM_HI2 (RWX) : org = 0x4030F3F8, len = 0xC00 /* eeprom */


    SRAM_CM (RWX) : org = 0x44d00000, len = 0x4000 /* MMU table; Cortex-M3 unified RAM */
    SRAM_DM (RWX) : org = 0x44d80000, len = 0x2000 /* .stack; Cortex-M3 DRAM */
    DDR3 (RWX) : org = 0x80000000, len = 0x20000000
    }

    REGION_ALIAS("REGION_BSS", SRAM_HI0);
    REGION_ALIAS("REGION_HEAP", SRAM_HI0);

    REGION_ALIAS("REGION_STACK", SRAM_DM); /*I changed from DM to HI1*/

    REGION_ALIAS("REGION_TEXT", SRAM_HI1);
    REGION_ALIAS("REGION_DATA", SRAM_HI1); /*I changed from HI1 to DM*/
    REGION_ALIAS("REGION_ARM_EXTAB", SRAM_HI1);
    REGION_ALIAS("REGION_ARM_EXIDX", SRAM_HI1);

    REGION_ALIAS("REGION_IDATA", SRAM_HI2);

    Your code is compiled using a CCS project, correct? 

    Yes.

     Are you using a linker command file in the CCS project, or is the linker command file being auto-generated during project compilation?

    I am using linker command generated by linkcmd_bm_v7a.xdt from the gnu.target.arm  package.

    What does the linker execution look like on the command line?

    I haven't tried in command line. I am working in CCS only. Building and dumping the code using CCS only.

    Now i am Using CCSv8 as you said. 

    I am attaching the linker files Content for your reference.

    I have tried increasing the size of SRAM_HI1 in this link file, then build is successful(with UART Code), but code when flashed to AMIC110 is not working.

    So I have Removed the UART code for testing sake and increased the SRAM_HI1 size in the linker command file, the code which i have tested working on AMIC110, I used the same code to test by increasing the size of SRAM_HI1 in linker command file, but it also did not work. I thought that Its not the right way to increase the size of memory sections in this linker command file.

    Please give me some way how can i use the UART port along with the ethercat stack On AMIC110 board(TDMXICE110). VERY URGENT... KINDLY HELP..!

    /cfs-file/__key/communityserver-discussions-components-files/791/linker-comman-files.zip

  • Hi Frank,

    I have Increased the SRAM_HI1 size in the link command file, and the build is successful.

    Now when I am flashing the code to the controller the stack and UART are not working.

    But in when I am debugging the code stack and UART are working.

    during debugging I am able to send and recieve data through the UART. But when I am trying to communicate with TwinCAT, the device is not getting recognised.

    Can you tell what is the problem? and what is the solution for it?

    Please respond as soon as possible...

  • Hi Gupta,

    I'm glad to hear the UART is working.

    Please open separate E2E threads on any new issues you've encountered during your development.

    >> when I am flashing the code to the controller the stack and UART are not working

    >> when I am trying to communicate with TwinCAT, the device is not getting recognised

    Regards,
    Frank

  • Thank you frank,

    I will create a new thread as you said. Please respond for that as soon as possible...

    Regards,

    Gupta