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.

AM6548: Reading a register causes a fault.

Part Number: AM6548
Other Parts Discussed in Thread: SYSBIOS

Hello Experts,

I have written some code( A53 ) to access the below register

 

 

 

 

 

 

 

 

 

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

typedef struct

{

union {

uint32_t ADC_SEQUENCER;

volatile struct

{

uint32_t step_idle : 5;

uint32_t fsm_busy : 1;

uint32_t mem_init_done : 1;

uint32_t reserved : 25;

}STATUS;

};

}ADC0_SEQUENCER, ADC1_SEQUENCER;

#define ADC0_SEQUENCER ( *( (volatile ADC0_SEQUENCER* )0x40200044) )

#define ADC1_SEQUENCER ( *( (volatile ADC1_SEQUENCER* )0x40210044) )

then to read the register:

uint32_t a = ADC0_SEQUENCER.ADC_SEQUENCER;

a = a; // test

This cause the processor to exit on a fault… Is there any obvious reason for this.

Does the domain need to change ?

I have used the above code to access the PADCONFIG registers...no problems….but this is in a different DOMAIN….I’m not sure if this is relavant?

Some guidance, code would be appreciated.

Thanks

Carl

  • Hi Carl,

    Can you please provide some additional information, regarding what SDK / OS / Tool, the above code is being compiled and run from. 

    Thanks,

    kb

  • Hello KB

    Thanks for the reply...

    CCS 10.0 is the package. I've used the RTOS template for the AM65xx...running on A53 core.

    I've not used any library on this. I've accessed the registers directly ... basically trying to set up the ADC.

    Thanks

    Carl

  • Hello Carl,

    a few thoughts on your issue:

    - is the memory accessible in the debugger memory view, e.g. if you put a breakpoint BEFORE the crash?

    - did you add the memory ranges for the ADCs to the MMU page table?

    - personally I find bitfields used to access device registers "scary" - i wouldn't be sure exactly HOW the compiler outputs the access. if the memory is accessible in the debugger view, but your code crashes, you should check the disassembly at the point where it crashes

    Regards,

    Dominic

  • Hello Dominic

    Thanks for the help....appreciate it.

    No I cant see the value in memory....although it is there,  

    No I havn't put it in the MMU....

    Just looking at the MMU now trying to work it out ...if you have any good references by any chance?

    I think you've put the train back on the tracks

    Thanks

    Carl

  • Hello Carl,

    if your application is based on the rtos template app you should have a InitMmu function with lots of calls to Mmu_map.

    Just add a mapping for the ADC range(s). Physical address and virtual address should usually be the same, all of the TI code is using a 1:1 mapping. Size probably needs to be aligned to 4KB.

    It's possible that your application crashes BEFORE main if you add mappings. In that case the MMU table array length needs to be increased in the config file:

    var Mmu = xdc.useModule('ti.sysbios.family.arm.v8a.Mmu');
    Mmu.initFunc = "&InitMmu";
    Mmu.tableArrayLen = 24;

    It's kind of hard to tell WHEN the MMU table array needs to be increased, because it's not "1x Mmu_map" = "1 table entry", but rather depending on which virtual addresses get mapped, and how fine-grained the mappings are.

    Regards,

    Dominic

  • Hello Dominic

    Thanks for help 

    I ended up with this

    mapIdx++;
    retVal = Mmu_map(0x40200000, 0x40200000, 0x00002000, &attrs); /* adc0 */
    if(retVal == FALSE)
    {
    goto mmu_exit;
    }

    The size seems to works in increments of 1000h and Virtual Memory mapping is like for like...just like you said

    I can read the data ..its visible...

    Thanks for that ,,,you've been a great help

    Kind Regards

    Carl