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.

TMS570LC4357: TMS570 NMPU external diagnostics test

Part Number: TMS570LC4357

Hi,

I am working on NMPU external diagnostics test which is mentioned in TRM, section 11.3.2.2. I am trying to test DMA interface.

In step 7, it mentioned, Program the diagnostic address in MPUDIAGADDR register.

Could you please explain, what could be the address of this register. Is this the address we use as destination address of dma used for transaction.

Also could you please provide any example code available for NMPU external diagnostic testing with dma-nmpu.

Thanks

  • MPUDIAGADDR register

    This is the address in the region you want to test.

    Here is an example I just developed for you:

    nmpu_dmaREG->MPULOCK = 0x0A; //Writes to other MPU registers are allowed
    nmpu_dmaREG->MPUCTRL1 = 0x5; //Memory protection is disabled

    nmpuRegionAttributes_t nmpuConfig0;
    nmpuConfig0.accesspermission = NMPU_PRIV_RW_USER_RO;
    nmpuConfig0.regionsize = NMPU_SIZE_4_KB;
    nmpuConfig0.baseaddr = 0x08030000;

    nmpuEnableRegion(nmpu_dmaREG, NMPU_REGION0, nmpuConfig0);

    nmpuRegionAttributes_t nmpuConfig1;
    nmpuConfig1.accesspermission = NMPU_PRIV_RO_USER_RO;
    nmpuConfig1.regionsize = NMPU_SIZE_4_KB;
    nmpuConfig1.baseaddr = 0x08031000;

    nmpuEnableRegion(nmpu_dmaREG, NMPU_REGION1, nmpuConfig1);

    nmpu_dmaREG->MPULOCK = 0x0A;

    nmpu_dmaREG->MPUDIAGCTRL = 0 << 18 //treat transaction as user mode
    | 1 << 17 //treat transaction as write
    | 0 << 16 //internal diag mode
    | 0xa << 4; //enable diag

    nmpu_dmaREG->MPUDIAGADDR = 0x08031008;

    In this example, I enabled 2 UMPU regions for DMA. The end region (#1) is from 0x08031000 to 0x08032000, size=4KB, permission is read-only for pri and user.

    The diagnostic is configured as write access to 2nd region at 0x08031008 in user mode which violates the permission.

    Bit 27, 25, 16, and bit 0 are set. 

  • Hi Wang,

    Thank you so much for providing example code and all the details. This code example configured for internal diagnostic mode. I have tried this mode and works fine. when tried to configure for external diagnostic mode(updated bit 16 as 1 in MPUDIAGCTRL ) and initiated dma transaction(i see data is transferring from source to destination), no fault is logging in MPUERRSTAT as expected. This register value is 0. 

    I have configured as below. Following all steps mentioned in section section 11.3.2.2. Could you please help to provide reference code for external diagnostic mode if available. 

    nmpuRegionAttributes_t region1Attributes;
    region1Attributes.baseaddr = 0x08067000;
    region1Attributes.regionsize = NMPU_SIZE_4_KB;
    region1Attributes.accesspermission = NMPU_PRIV_NA_USER_NA;

    nmpu_dmaREG->MPUDIAGCTRL = 0 << 18 //treat transaction as user mode
    | 1 << 17 //treat transaction as write
    | 1 << 16 //external diag mode
    | 0xa << 4; //enable diag

    Thanks for all your help

  • I am able to resolve the issue. Thanks for all the support.