There is an example "Example_S32KXX_DS_Fls" in S32 DS 3.4 for your reference. I just tested it and it works fine on my side.
BR!
Jim,
There is an example "Example_S32KXX_DS_Fls" in S32 DS 3.4 for your reference. I just tested it and it works fine on my side.
BR!
Jim,
Hi,Selent
Thank you for reply!
The example in S32DS3.4 is to control the data flash It works well.
And I made a change to erase and write the code flash,erase is OK but write always failed.
Do you know why?
The code is as below
main.c
#define FLS_START_ADDR 0x0U
#define FLS_INTERNAL_SECTOR_SIZE 0x2000U
#define FLS_NUM_OF_INTERNAL_SECTOR 25U
#define FLS_BUF_SIZE 104U
Fls_Init(NULL_PTR);
Fls_RXBufInit();
Fls_TXBufInit();
Fls_Erase(FLS_START_ADDR,FLS_INTERNAL_SECTOR_SIZE*FLS_NUM_OF_INTERNAL_SECTOR);
while(Fls_GetStatus()!=MEMIF_IDLE)
{
Fls_MainFunction();
}
if (MEMIF_JOB_OK != Fls_GetJobResult())
{
checkresult=false;
}
returnresult=Fls_Write(FLS_START_ADDR,Fls_TxData,FLS_BUF_SIZE);
while(Fls_GetStatus()!=MEMIF_IDLE)
{
Fls_MainFunction();
}
if (MEMIF_JOB_OK != Fls_GetJobResult())
{
checkresult=false;
Siul2_Dio_Ip_TogglePins(LED_2_PORT,(1<<LED_2_PIN));
}
Fls_Cfg
#define FLS_PROGRAM_FLASH_BASE_ADDR (0x00400000UL)
Fls_BOARD_InitPeripherals_PBcfg.c
static const Fls_Flash_InternalSectorInfoType FlsSector_0_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x032000UL),
57U
};
static const Fls_Flash_InternalSectorInfoType FlsSector_1_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x034000UL), /* pSectorStartAddressPtr */
58U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_2_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x036000UL), /* pSectorStartAddressPtr */
59U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_3_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x038000UL), /* pSectorStartAddressPtr */
60U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_4_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x03A000UL), /* pSectorStartAddressPtr */
61U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_5_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x03C000UL), /* pSectorStartAddressPtr */
62U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_6_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x03E000UL), /* pSectorStartAddressPtr */
63U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_7_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x040000UL), /* pSectorStartAddressPtr */
64U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_8_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x042000UL), /* pSectorStartAddressPtr */
65U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_9_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x044000UL), /* pSectorStartAddressPtr */
66U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_10_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x046000UL), /* pSectorStartAddressPtr */
67U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_11_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x048000UL), /* pSectorStartAddressPtr */
68U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_12_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x04A000UL), /* pSectorStartAddressPtr */
69U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_13_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x04C000UL), /* pSectorStartAddressPtr */
70U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_14_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x04E000UL), /* pSectorStartAddressPtr */
71U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_15_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x050000UL), /* pSectorStartAddressPtr */
72U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_16_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x052000UL), /* pSectorStartAddressPtr */
73U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_17_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x054000UL), /* pSectorStartAddressPtr */
74U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_18_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x056000UL), /* pSectorStartAddressPtr */
75U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_19_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x058000UL), /* pSectorStartAddressPtr */
76U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_20_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x05A000UL), /* pSectorStartAddressPtr */
77U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_21_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x05C000UL), /* pSectorStartAddressPtr */
78U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_22_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x05E000UL), /* pSectorStartAddressPtr */
79U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_23_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x060000UL), /* pSectorStartAddressPtr */
80U /* Sector location to calculate cfgCRC */
};
static const Fls_Flash_InternalSectorInfoType FlsSector_24_FlsConfigSet_BOARD_InitPeripherals_sInternalSectorInfo =
{
(FLS_PROGRAM_FLASH_BASE_ADDR + 0x062000UL), /* pSectorStartAddressPtr */
81U /* Sector location to calculate cfgCRC */
};