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.

EDMA3 register access causes exception

Other Parts Discussed in Thread: SYSBIOS

I know that there must be something I'm missing here, but I've exhausted everything in front of my nose so I'm hoping someone can help.  I'm using the ICE board with sys/bios SDK 1.0.0.3.  I'm creating a program based on the standard EtherCAT example, and adding to it.  So far, all has been going well (added SPI access to my equipment, etc.) Now, I'm trying to enable the EDMA to manage the SPI accesses, and something strange is occurring: I've followed the mcspiFlash_edma.C example for guidance, and it all makes sense.  In my code, I call all the init routines per the example, such as EDMA3Initialize(), etc.  This all appears to be working correctly because until EDMAModuleClkConfig() gets called, the EDMA module (at address 0x49000000) isn't even accessible via CCS debug perspective.  But after the Clk module config, I can view and interact with all the available EDMA registers via the "memory browser" tab of the debug perspective.  The values of these registers even makes sense (such as the PID @ offset 0 etc).  So you would think the rest of the code should work fine.  But alas no.

Whenever my code attempts to access any of the EDMA registers (read or write), the processor immediately throws an exception.  In the example program, EDMA3Initialize()  calls EDMA3Init(SOC_EDMA30CC_0_REGS, EVT_QUEUE_NUM), which does a bunch of "HWREG" accesses to configure the EDMA registers.  But any of these throws a processor exception:

[CortxA8] dle: 0x80030948.
Task stack base: 0x80023158.
Task stack size: 0x800.
R0 = 0x00000000  R8  = 0xffffffff
R1 = 0x44e00004  R9  = 0xffffffff
R2 = 0x8000550c  R10 = 0xffffffff
R3 = 0x8001f338  R11 = 0xffffffff
R4 = 0xffffffff  R12 = 0x49000000
R5 = 0xffffffff [CortxA8]  SP(R13) = 0x80023928
R6 = 0xffffffff  LR(R14) = 0x80004fc4
R7 = 0xffffffff  PC(R15) = 0x80004fc8
PSR = 0x4000019f
ti.sysbios.family.arm.exc.Exception: line 174: E_dataAbort: pc = 0x80004fc8, lr = 0x80004fc4.
[CortxA8] xdc.runtime.Error.raise: terminating execution 

 

After EDMAModuleClkConfig() is called, even the simplest EDMA register access debug instruction such as (taken from Disassembly window):

:

323           test1 = HWREG(SOC_EDMA30CC_0_REGS + 0);

80004fc4:   E3A0C449 MOV             R12, #1224736768

80004fc8:   E59CC000 LDR             R12, [R12]

80004fcc:   E58DC000 STR             R12, [R13]

:

(which should read the EDMA's PID register which I can see in the memory browser window has a value of 0x40014C00) throws an exception at the 2nd assembly instruction where the read of 0x49000000 via R12 is attempted.

So I'm quite confused how I can freely access the (apparently) properly-initialized EDMA module via the "Memory Browser" window of CCS, but even the simplest attempt to read or write a register via my program throws an exception.

Any help is appreciated!

  • Hi,

    You will have to add EDMA base addresses (EDMACC - 0x49000000, EDMA3TC0) - 0x49800000, EDMA3TC1 - 0x49900000, EDMA3TC2 - 0x49a00000) in the mmuInit () in sys_mmu.c file in similar fashion other memories are mapped. Each entry adds 1MB page from the location. Then compile the sysbios driver library again.

    Also, you can upgrade to the latest sdk 1.0.0.4 which has some additional features and bug fixes.

    Regards,

    Amit

  • Hello Darrin Hansen,

    It looks like an MMU issue. The regiter memory for EDMA is not present in MMU translation table.

    In Ind SDK 1.0.0.3, MMU is configured from sys_bios_driver.lib. For now, please add the following lines of code to sys_mmu.c found at sdk\drivers\src and then rebuild sys_bios_driver.lib.

        Mmu_setFirstLevelDesc((Ptr)0x49000000, (Ptr)0x49000000 , &attrs);  // EDMA
        Mmu_setFirstLevelDesc((Ptr)0x49800000, (Ptr)0x49800000 , &attrs);  // EDMA
        Mmu_setFirstLevelDesc((Ptr)0x49900000, (Ptr)0x49900000 , &attrs);  // EDMA
        Mmu_setFirstLevelDesc((Ptr)0x49a00000, (Ptr)0x49a00000 , &attrs);  // EDMA

    The new SDK release 1.0.0.4 is available for download now. This release has lot of changes and I would recommend you to move..

    Regards,

    Shahid

  • Thanks both of you for your help: I should have suspected the MMU.

    I made the switch to 1.0.0.4 and I see what you mean by there being a lot of changes.  In 1.0.0.4 the EDMA3CC block is mapped to the MMU, but the EDMA3TC0..2 register areas still are not by default (but that was a simple change).  But perhaps a suggestion for 1.0.0.5 would be to map the TC's by default as well, as mapping just the EDMA3CC area alone is pointless as the first call to EDMAModuleClkConfig() will throw an exception, as this (tweaked from 1.0.0.3) function now modifies 0x49800010, 0x49900010 and 0x49A00010.  I'm not even sure what those registers are, as they are not documented in the TC register list in TRM rev. F.

    But thanks again - I am at least moving forward.

    Darrin