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.

TMS570LS1227: Initialising UART

Part Number: TMS570LS1227
Other Parts Discussed in Thread: HALCOGEN,

Hi,

I am trying to start UART communication from the TMS570LS12x HDK in order to send data to computer terminal. I have followed the SCI2 tutorial (www.youtube.com/watch  and got it working. However, I am trying to implement UART communication in an existing application. Code generation through HALCoGen was nice when creating a new project, but I have problems on how to go forward with this without HALCoGen... 

I have tried the code from www.ti.com/.../spna124a.pdf CCS does not recognise the SciREG1 or SciReg1 command.

What i want to do is to send some data I am generating in my existing code through the computer via. UART on the TMS570. I dont think i need an UART interrupt for this, because it is event driven, and I am not sending any information to the TMS570.

Do you have any pointers on how to go forward with this? I am quite new to the TI MCU family and CCS.

Kind Regards
Markus 

  • Hello Markus,

    If you are trying to implement this in existing code, where was the existing code generated? Was it generated outside of HalCoGen or was it made with Halcogen and can't be brought back into it due to compatibility concerns or due to concerns of loosing customization.

    Does the existing code have SCI drivers already in place for other SCI ports? If so, this makes it a bit more tricky due to possible conflicts, but you can still use HalCoGen to generate the code. So, if you have already done the exercise to create the drivers based on the SCI2 tutorial, you just need to copy the SCI drivers from Halcogen into your existing project and dd the same function calls for init into main. After that just add the calls to transmit data functions where you need them. You are correct that you shouldn't need to add any interrupts. Simple transmits at the time you want them should be fine.
  • Hi Chuck,

    The existing code is from an Example code for FlexRay provided for the TMS570LS31... That I have running for node A and node B. I have to send the FlexRay messages over UART. processors.wiki.ti.com/.../FlexRay_Communication_CCSv5.zip

    HalCoGen has no support for FlexRay drivers, so I assume this was not generated in HalCoGen.

    When you say import the SCI driver. Is that all the .h files in the include folder? Because the sci.h includes reg_sci.h which inluces reg_gio.h which.... and so on.

    Kind Regards
    Markus
  • Hi Markus,

    I've had a look at the project and it seems that you should be able to import it into HalCoGen by opening the file LS31_FlexRay_test1.hcg. Halcogen will open the project and you will have the ability to update the configuration of the SCI peripherals through Halcogen without interfering with the custom content within the "USER CODE" sections or in the FlexRay related driver files. Since the meat of the project is in main within one of these sections and the FlexRay drivers are in their own files, Halcogen shouldn't overwrite anything important to you. Once you have the project open, you would follow the steps to setup SCI/UART that you did when configuring the SCI example.

    As always, be sure to backup your working FlexRay code before trying this in case something breaks; but, in principle, there should be no issues with this methodology.
  • Hi Chuck,

    So what i tried now is:

    1) Made a copy of the code in CCS/new project to test the SCI.

    2) In HalCoGen: open - project - (copy of project) - LS31x_FlexRay_test1.hcg. Then i followed the steps of the video. (I only enabled the SCI2 driver as in the video), then generate code.

    3) Then i launced CCS and tried to Build Debug for the project. 26 errors occured, mainly #1965 "Cant open source file ".h" and "gmake: ** [] error 1"

    4) I then went in to properites of the project - include options and included the /include folder. I then got 83 Errors:

    #10010 errors encountered during linking; "FR_NodeA_SCI.out" not built FR_NodeA_SCI C/C++ Problem
    #10264 FLASH0 memory range overlaps sys_link.cmd /FR_NodeA_SCI/source line 58 C/C++ Problem

    and many others.... 

    I also tried to include the /source folder to the project, however, this didnt do much of a difference. Do you have any suggestions here?

    Kind Regards
    Markus

  • Hello Markus,

    Sounds like the results were largely disappointing. I will attempt some other methods and post the project when I find the one that works. This will probably take me through next Tuesday or Weds. to finish. I will get back with you when I have the results to share.
  • Hello Chuck,

    Somewhat largely disappointing yes :) Thank you, that would be of great help! 

    Looking forward to hearing from you.

    Kind regards

    Markus

  • Hi Markus,

    Sorry for the long delay in getting back to you.

    I've attached a node A project where I integrated the SCI drivers. There are still some warnings but I think this will give you a good starting point example. The SCI code in main is in a while loop because I don't have a FlexRay setup. Basically, I configured an SCI configuration (see example in halcogen examples under help menu) using HalCoGen then copied the SCI related files into the Node A project. I had to do some careful updates to bring in some of the #defines from the bigger HalCoGen project since HalcoGen updates over the years has migrated to a different method of partitioning the global defines but I was able to compile with only some warnings. Give it a try and see if you can get the output you need.

    6011.Antares_FlexRay_CCSv5_example_code_nodeA.zip

  • Hi Chuck!

    I have been working on some other problems, sorry for answering so late!

    I have run the project and the UART communacation worked and printed to terminal, thank you :)

    I did not get the project to run when I removed the while loop on order to print for each transmit_check_node_a, in fact, I did not get your project to run with FlexRay even without the UART print, could this be some port settings that have changed? The project was able to build and debug, but the MCU got stuck waiting for interrupt from the FlexRay controller.

    I will try to do some more debugging here in order to understand the SCI setup in this project.

    Kind Regards
    Markus

  • Markus,

    If you remove the UART code I added, would the FlexRay communication start to work again? Or was it never really working to begin with?
  • Hi Chuck,

    Thank you,

    I removed the following from your code:

    // while(1) /* continious desplay */
    // {
    // sciDisplayText(UART,&TEXT1[0],TSIZE1); /* send text code 1 */
    // sciDisplayText(UART,&TEXT2[0],TSIZE2); /* send text code 2 */
    // sciDisplayText(UART,&TEXT3[0],TSIZE3); /* send text code 3 */
    // wait(200);
    //};

    When running the code on the TMS570LS1227, it gets stuch here:

    In Flexray.c
    while ((Fray_PST->SIR_UN.SIR_UL & 0x4) == 0x0); // wait for CYCS interrupt flag.

    This is the same problem as when i start the communication with only one node connected to the network. When I run the original code.

    I have also tried to run it with every combination activated of these:
    gioInit();
    sciInit();

    However, the communication will not start running your code.

    In the origial code, the FlexRay communication is running just fine. I am also using an analyser in order to verify this.
    I am running the original code on node B through this testing.

    Best Regards
    Markus
  • Hello Markus,

    I simply added the calls to sci init function and to the sci send data functions. I did not make any changes to your original code. Perhaps it is something related to the header files that were added that caused some type definition to be corrupted. Can you revert to your old project and try implementing the new files and lines of code piece b piece to isolate where any errors might have been introduced?