Reading from D-Flash causes bus fault exception (S32K148)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Reading from D-Flash causes bus fault exception (S32K148)

ソリューションへジャンプ
1,355件の閲覧回数
Moh-Moh
Contributor II

Hi there,

I'm having a strange issue where we have partitioned the flash into p flash and d-flash using the NXP example (flash_partitioning_s32k148). 

After loading on the next application, and attempting to read from flash addresses 0x10000000, I am seeing a bus fault handler exception from the MCU. 

Using Eclipse IDE, and using the memory window I can see the data inside this region of flash (0x10000000 onwards), so am unsure what the issue is.

For reference the piece of code Im using is a very simple one and is below 

 

    status_t ret;        /* Store the driver APIs return code */
    uint32 * address;
    uint32 i = 0u;
    uint32 data2[10] = 0u;

    /* Always initialize the driver before calling other functions */
    ret = FLASH_DRV_Init(&Flash1_InitConfig0, &flashSSDConfig);
    DEV_ASSERT(STATUS_SUCCESS == ret);

    for (i = 0; i < 10; i++)
    {
        address = (uint32*)(flashSSDConfig.DFlashBase + (i * 4));
        data2[i] = *address;
    }

 

 

Any help on how to read this region of flash would be very much appreciated

0 件の賞賛
返信
1 解決策
1,327件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @Moh-Moh 

wasn't the partition already set before running flash_partitioning_s32k148?

If partition is not set and if you run the example from RAM then Erase All Blocks command is executed. This ensures that everything is in default state and the flash is completely erased. Then it should be possible to read data flash at 0x10000000.

I did quick check on my side and I can't see this problem. Everything works as expected.

To start over, you can try to run this piece of code from the example regardless of EEESize:

lukaszadrapa_0-1722410263123.png

 

In other words, this code is executed only if partition is not set yet. You can modify the condition to run this code in any case. Then the device will be completely erased and I believe the problem will disappear.

Regards,

Lukas

元の投稿で解決策を見る

2 返答(返信)
1,312件の閲覧回数
Moh-Moh
Contributor II

Hi Lukas, 

 

Thanks for the help on this! For those that come after me, the actual issue lay with the MPU for me. The application did not have these memory locations as a defined region, and so threw a bus fault when a read was attempted outside mpu defined memory spaces 

0 件の賞賛
返信
1,328件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @Moh-Moh 

wasn't the partition already set before running flash_partitioning_s32k148?

If partition is not set and if you run the example from RAM then Erase All Blocks command is executed. This ensures that everything is in default state and the flash is completely erased. Then it should be possible to read data flash at 0x10000000.

I did quick check on my side and I can't see this problem. Everything works as expected.

To start over, you can try to run this piece of code from the example regardless of EEESize:

lukaszadrapa_0-1722410263123.png

 

In other words, this code is executed only if partition is not set yet. You can modify the condition to run this code in any case. Then the device will be completely erased and I believe the problem will disappear.

Regards,

Lukas