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.

AM4379: ADC1 initialisation not happened ....

Part Number: AM4379


Hi,

I have ported the ADC1 for AM4379 chip-set in Ti-RTOS environment. During the ADC1 initialisation "ADC instance is not present on the SOC" error occurred.(Hope you have get enough details from its previous thread).


Debug Print:

StarterWare Boot Loader
BOARDInit status [0x0]
Platform : 2
SoC : [AM43XX]
Core : [A9]
Platform : 2
Board Detected : [IDKEVM]
Base Board Revision : [UNKNOWN]
Daughter Card Revision: [UNKNOWN]
Platform : 2
Copying application image from MMC/SD card to RAM
Jumping to StarterWare Application...
<<<<Start BIOS>>>>
ADC0 Test Start... 
StarterWare ADC voltage measure application!!

ADC0: Base Addr: 0x44e0d000ADC Step configuration. Done!!
ISR :[0]
ISR RISED.... Success
Number of samples in FIFO: 8
FIFO Data:
Step-ID:0 ADC-CH:0 Voltage Level: 1196mV
Step-ID:1 ADC-CH:1 Voltage Level: 820mV
Step-ID:2 ADC-CH:2 Voltage Level: 0mV
Step-ID:3 ADC-CH:3 Voltage Level: 812mV
Step-ID:4 ADC-CH:4 Voltage Level: 813mV
Step-ID:5 ADC-CH:5 Voltage Level: 806mV
Step-ID:6 ADC-CH:6 Voltage Level: 0mV
Step-ID:7 ADC-CH:7 Voltage Level: 0mV
Stop ADC
Power Down ADC
ADC Exit..!!

ADC0 Test End...

ADC1 Test Start...
ADC-1: StarterWare ADC-1 voltage measure application!!
ADC instance is not present on the SOC.
ADC-1: Exiting from the application
ADC-1: Stop ADC


Kindly help me to resolve this issue.



  • Suresh,

    Sorry, I think what I told you regarding changing ADC0 definitions to ADC1 definitions is incorrect: https://e2e.ti.com/support/processors/f/791/p/847678/3146350#3146350

    Checking for the failure message you observe, I see this failure occurs in volt_measure_app_main.c:AdcAppSocInfoGet(), which indicates CHIPDBIsResourcePresent(CHIPDB_MOD_ID_ADC0, pObj->instNum) doesn's return TRUE. This indicates to me that Starterware considers ADC0 a different hardware IP than ADC1.

    Browsing through the TRM, I see hardware differences between Touch Screen Controller ADC0 & Magnetic Card Reader ADC1. The MM register set for each ADC is different, and the bit fields in some corresponding registers are different, e.g. compare ADC0_STEPCONFIG1 & ADC1_STEPCONFIG_1. However, it appears both ADC0 & ADC1 can be used for 8 general-purpose ADC channels.

    I searched PRSDK again for a driver & example for AM437x ADC1. Unfortunately I wasn't able to locate anything.

    • Some basic definitions in Starterware for ADC1, but no code in DAL corresponding to code in tsc_adc_ss.c for ADC0.
    • Starterware example is for TSC ADC0.
    • CSL example is for ADC on other TI platforms, e.g. TDA3xx, DRA78x, AM65xx.

    I also checked the recently released PRSDK 6.1.0.8, and didn't find anything in the release notes or the code for AM437x ADC1.

    To use ADC1, it appears you'll need to develop code similar to the DAL code in tsc_adc_ss.c.

    I'll ask internally whether my understanding of the situation is correct.

    Regards,
    Frank

  • Suresh,

    I followed up on this more internally. The recommendation is to use the Starterware TSC ADC code as a starting place for working with ADC1. Although there are hardware differences between the two ADC's, ADC1 operates the same as ADC0 when used in general purpose mode. ADC1 just has a different analog front end which contains a preamp. The preamp is disabled when using it as a general purpose ADC (see register ADC1_CTRL, bit fields PREAMP_BYPASS AND PREAMP_PD)

    Please let me know if this answers your question.

    Regards,
    Frank

  • Hi Frank, 

    Thanks for your followup & I can able understand the differences your specified for the ADC1 & ADC0. 
     

    I have configured the ADC1 initialisation as below,


           pObj->instNum = 0U;

          CHDBIStatus = CHIPDBIsResourcePresent(CHIPDB_MOD_ID_ADC1, pObj->instNum);


    The CHIPDBIsResourcePresent API is getting failed. Because of that faced "ADC instance is not present on the SOC." error print. So i have analysed that API & found below things,

    #1: present = CHIPDB_IS_RESOURCE_PRESENT(basePN, resID);  Why this API return false & how to resolve it?

    #2: Why ADC1 present in CHIPDBIsSecureModule API? (For your Information, I have removed ADC1 from the Secure Module list for testing purpose. But the ADC1 get failed Because of #1.

    So I wanted to know how fix the #1?.

    I have try to read the ADC1 registers (CCS&JTAG) but faced the "unable to read" issue.But ADC0 registers readout successfully. 

    ADC1:  

    ADC0:


    Kindly help to fix this issue to move further.

    Regards,
    Suresh





       

  • Hi Frank,

    I have resolved the unable to read ADC1 registers issue.But still, I have faced the below issue,

    //--------------------------------------------------------------------------------
           pObj->instNum = 0U;

          CHDBIStatus = CHIPDBIsResourcePresent(CHIPDB_MOD_ID_ADC1, pObj->instNum);

    //--------------------------------------------------------------------------------
    The CHIPDBIsResourcePresent API is getting failed. Because of that faced "ADC instance is not present on the SOC." error print. So i have analyzed that API & found below things,

    #1: present = CHIPDB_IS_RESOURCE_PRESENT(basePN, resID);  Why this API return false & how to resolve it?

    #2: Why ADC1 present in CHIPDBIsSecureModule API? (For your Information, I have removed ADC1 from the Secure Module list for testing purposes. But the ADC1 get failed Because of #1.

    Kidly help.


    Regards,
    Suresh.

  • Hi Suresh,

    #1: present = CHIPDB_IS_RESOURCE_PRESENT(basePN, resID) returns 0?

    I see CHIPDB_IS_RESOURCE_PRESENT() is called from CHIPDBIsResourcePresent().I assume you're calling CHIPDBIsResourcePresent() with the module ID for ADC1, e.g. CHIPDBIsResourcePresent(CHIPDB_MOD_ID_ADC1, 0)

    I see the following function calls in the TSC ADC0 example application (volt_measure_app_main.c):

    main()

    -> AdcAppSocInfoGet()

    -> CHIPDBIsResourcePresent(CHIPDB_MOD_ID_ADC1, 0) // returns 0

    -> resID = CHIPDB_GET_RESOURCEID(moduleID, instance)

    -> basePN = ChipDBReadBasePNEncoding()

    -> present = CHIPDB_IS_RESOURCE_PRESENT(basePN, resID);  // returns 0

    • CHIPDB_GET_RESOURCEID() returns gChipDBResourceIDMap[moduleID] + instance.
      • The module ID parameter is CHIPDB_MOD_ID_ADC1=61 (see pdk_am437x_1_0_16\packages\ti\starterware\include\am335x\chipdb_defs.h).
      • The instance parameter is 0.
      • gChipDBResourceIDMap[] maps the pair (moduleID, instance) to unique Resource ID (this is described in detail in pdk_am437x_1_0_16\packages\ti\starterware\soc\am43xx\hw_am43xx_chipdb.c).
      • gChipDBResourceIDMap[61+0]=47 (ADC1 resource ID).

    • ChipDBReadBasePNEncoding() always returns 0x0 for basePN.
    • CHIPDB_IS_RESOURCE_PRESENT() inspects gChipDBResourceTable[] to determine whether the resource associated with Resource ID is present.
      • Note CHIPDBIsResourcePresent() never arrives at this check if CHIPDB_GET_MAX_INST(moduleID) > instance)) returns FALSE. This isn't the case for ADC1.
      • BasePN=0. ResID=47 => resID/32=1, resID%32=15.
      • gChipDBResourceTable[BasePN][resID/32]=gChipDBResourceTable[0][1]=0xF39F08FFU.
      • 0xF39F08FFU>>15&0x1 = 0 => resource isn't present.
      • It seems like changing gChipDBResourceTable[0][1] to 0xF39F88FFU should cause CHIPDB_IS_RESOURCE_PRESENT() to indicate the resource is present, but I haven't confirmed this.
      • I notice the comments above gChipDBResourceTable[][] state the table is auto-generated. However, I don't know how the table is auto-generated.

    Key locations in source code
    include/am43xx/chipdb_defs.h:128: CHIPDB_MOD_ID_ADC1 = 61U,

    include/am43xx/hw_am43xx_chipdb.h:123:#define CHIPDB_GET_RESOURCEID(moduleID, instance) \
    include/am43xx/hw_am43xx_chipdb.h-124- (gChipDBResourceIDMap[moduleID] + instance)

    soc/am43xx/hw_am43xx_chipdb.c:112:const uint32_t gChipDBResourceIDMap[CHIPDB_MOD_ID_COUNT + 1] =

    soc/am43xx/am43xx_chipdb.c:471:static uint32_t ChipDBReadBasePNEncoding(void)

    soc/am43xx/am43xx_chipdb.c:128:#define CHIPDB_IS_RESOURCE_PRESENT(BasePN, resID) \
    soc/am43xx/am43xx_chipdb.c-129- (CHIPDB_BIT_VALUE(gChipDBResourceTable[BasePN][resID/32], resID%32))

    soc/am43xx/am43xx_chipdb.c:121:#define CHIPDB_BIT_VALUE(value, bit) (((uint32_t)value >> bit) & 0x1)

    soc/am43xx/hw_am43xx_chipdb.c:285:gChipDBResourceTable[CHIPDB_DEVICE_COUNT][CHIPDB_RESOURCE_RECORD_SIZE] =

    #2: ADC1 identified as secure hardware module in CHIPDBIsSecureModule()?
    I don't know why Starterware treats ADC1 as a secure hardware module, and I don't know of any reasons ADC1 can't be used for General Purpose ADC measurements on a GP device (as indicated in the TRM). I'll follow up internally to see if there are any hardware constraints.

    I notice ChipDBReadSecurityLevel() is hard-coded to always return CHIPDB_SL_GP, regardless of the value read from the CONTROL_MODULE:CTRL_STS:DEVTYPE bit field. Hence it appears any hardware module listed in the case statement in CHIPDBIsSecureModule() will be disallowed by CHIPDBIsResourcePresent().

    I think it's safe to remove CHIPDB_MOD_ID_ADC1() from the list.

    Regards,
    Frank

  • Hi Frank,

    For #1, Suggested  Value is not working  & still, I have faced the same issue.

    //------------------------- Modified Source -------------------------------


    File Name: hw_am43xx_chipdb.c
    Modified Source : 


    const uint32_t
    gChipDBResourceTable[CHIPDB_DEVICE_COUNT][CHIPDB_RESOURCE_RECORD_SIZE] =
    {
    /*
    * The table values are to be auto-generated
    */
    /*
    {part0_bit_enc_31_0, part0_bit_enc_63_32, part0_bit_enc_95_64,
    part0_bit_enc_127_96},

    {part1_bit_enc_31_0, part1_bit_enc_63_32, part1_bit_enc_95_64,
    part1_bit_enc_127_96},

    {part63_bit_enc_31_0, part63_bit_enc_63_32, part63_bit_enc_95_64,
    Part63_bit_enc_127_96}
    */
    {
    0xFFFFFFFFU,
    0xF39F88FFU,
    0xFFFFDFFDU,
    0xF00C0000U,
    0xFFFFFFFFU,
    0xFFFFFFFFU,
    },
    {
    0xFFFFFFFFU,
    0xF3DF6BFFU,
    0xFFFFDFFDU,
    0xF80C0000U,
    0xFFFFFFFFU,
    0xFFFFFFFFU,
    },
    {
    0xFFFFFF9FU,
    0xFFFFFFFFU,
    0xFE7FFFFDU,
    0xF80DFFFFU,
    0xFFFFFFFFU,
    0xFFFFFFFFU,
    },
    {
    0xFFFFFF9FU,
    0xFFFFFFFFU,
    0xFE7FFFFDU,
    0xF82DFFFFU,
    0xFFFFFFFFU,
    0xFFFFFFFFU,
    },
    {
    0xFFFFFFFFU,
    0xF39F7BFFU,
    0xFFFFDFFDU,
    0xF00C0000U,
    0xFFFFFFFFU,
    0xFFFFFFFFU,
    }
    };


    For #2, I have removed ADC1 from the Secure module list,

    Kindly help to resolve the #1 issue.


    Regards,
    Frank

  • Hi Suresh,

    Did you step into CHIPDBIsResourcePresent() and check the behavior?

    • What are the moduleID and instance parameters?
    • What value is returned by resID = CHIPDB_GET_RESOURCEID(moduleID, instance)?
    • What value is returned by basePN = ChipDBReadBasePNEncoding()?
    • What is resID/32? What is gChipDBResourceTable[BasePN][resID/32]?
    • What is gChipDBResourceTable[BasePN][resID/32], resID%32)

    Regards,
    Frank

  • Hi Frank,

    Thanks for your support.  Sorry for the inconvenience caused by me.Since I forget rebuilt the application library files after applying the changes (You're suggested in the previous post). I just shared the test result values for your reference.  

    Frank Livingston said:

    Did you step into CHIPDBIsResourcePresent() and check the behavior?

    • What are the moduleID and instance parameters?

    Result: ModuleID: CHIPDB_MOD_ID_ADC1 (61U) Instance: 0

    • What value is returned by resID = CHIPDB_GET_RESOURCEID(moduleID, instance)?

      Result:  resID: 0x2f

    • What value is returned by basePN = ChipDBReadBasePNEncoding()?

              Result:  basePN: 0x0

    • What is resID/32? What is gChipDBResourceTable[BasePN][resID/32]?

              Result:  resID/32: 0x1

    • What is gChipDBResourceTable[BasePN][resID/32], resID%32)

              Result:  0xf39f88ff

    Currently, I have faced the interrupt not raised an issue for ADC1 & I'll working on it.  For the ADC1 interrupt not raise an issue I'll create a separate post. 

     
    Thanks again for the wonderful support!!.