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.

Problem with the example_adcDisplay of TMS570LC4357 microcontroller.

Part Number: LAUNCHXL2-570LC43
Other Parts Discussed in Thread: HALCOGEN,

Tool/software: Code Composer Studio

I am new to the Hercules platform and am learning it from the example programs provided with the HALCoGen. I made a project for calculating the voltage at the AI1_0 & AI1_1 pins. I did everything as the example program had suggested.

For the connections part: I connected the AD REF LO to Ground and AD REF HI to 5V.

When I connect AI1_1 or AI1_0 to  5V, the result on the terminal shows to be 0x000000FO, and for 3.3 V 0x0000009A. Which is confusing since for 5V I expected 0x00000FFF.

I Calculated the 9A value considering F0 to be 5V and it comes around 3.2V which is fine. But can anyone help me get the 5V as FFF to have the 12Bit resolution of the ADC that I wanted?

I will attach my project file.https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/312/3580.ADC_5F00_UART.7z

Also I am getting only the Channel ID and the Data. Is there a easy way to get the Pin ID too?

  • Hell Yash,

    As shipped, the LAUNCHXL2-570LC43 is configured with the ADC as 3.3V. Did you remove R3 and populate R4 (see page 2 of the schematic) to supply VCCAD and ADREFHI with 5V?

  • Hello Bob,
    Thanks for pointing that out. But that still doesn't answer the question as to why I am getting the value 0x000000F0 when I should be getting 0x00000FFF for any value above the VCC AD.
    As I mentioned I am getting 0x000000F0 for 5V on PuTTy (my terminal) and 0x0000009A for 3.3V.
    I am working with 12-bit resolution.
    Also could help me with getting the pin ID, along with the channel id?

    Thanks
    Yash Bansod
  • Yash Bansod said:
    But that still doesn't answer the question as to why I am getting the value 0x000000F0 when I should be getting 0x00000FFF for any value above the VCC AD.

    I ran your example in an unmodified LAUNCHXL2-570LC43, i.e. one in which VCCAD and ADREFHI were +3.3V.

    With AD1IN_0 connected to +3.3V then the debugger showed that the value read from the ADC was 0xFFF as expected, yet the text output to the serial port reported the value 0x000000F0:

            CH.ID=0x00000000        VALUE=0x000000F0

    I traced the problem to a bug in the sciDisplayData() function on this block of code:

            if(txt<=0x9)
            {
                txt +=0x30;
            }
            else if(txt > 0x9 && txt < 0xF)
            {
                txt +=0x37;
            }
            else
            {
                txt = 0x30;
            }

    The bug is that a hex digit of 0xF gets reported as 0.

    The code should be:

            if(txt<=0x9)
            {
                txt +=0x30;
            }
            else if((txt > 0x9) && (txt <= 0xF))
            {
                txt +=0x37;
            }
            else
            {
                txt = 0x30;
            }

    The bug in the sciDisplayData() function is in the following example source files in HALCoGen v04.06.00:
    - examples\RM42x_41x\example_adcDisplay.c
    - examples\RM44x\example_adcDisplay.c
    - examples\RM46x\example_adcDisplay.c
    - examples\RM48x\example_adcDisplay.c
    - examples\RM57Lx\example_adcDisplay.c
    - examples\TMS570LC43x\example_adcDisplay.c
    - examples\TMS570LS04x_03x_02x\example_adcDisplay.c
    - examples\TMS570LS09x_07x\example_adcDisplay.c
    - examples\TMS570LS12x_11x\example_adcDisplay.c
    - examples\TMS570LS31x_21x\example_adcDisplay.c

  • Chester,
    Thank you very much for your help. I will pass on the information to the HALCoGen team so that we can get those examples corrected.
  • Thank You Chester.

    I am new to Hercules microcontrollers and was unable to find how to remove R3 and populate R4. Can you help me out?

  • I am new to Hercules microcontrollers and was unable to find how to remove R3 and populate R4.

    You need to modify the LAUNCHXL2-570LC43 by removing the zero ohm resistor at location R3, and populate R4 with a zero ohm resistor.

    Where R3 and R4 are located on the top of the board as shown from the following part of the LAUNCHXL2-570LC43 board layout:

  • Thanks Chester for your prompt reply.