Hi,
I want write data to the Parallel Flash.
I have an NXDB500-SYS Board and uses following configuration
/*
************************************************************
* Definition of the Par Flash-Instances
************************************************************
*/
STATIC CONST FAR RX_PARALLELFLASH_SET_T atrXPFlsh[] = {
{ {"SYSFLASH1",RX_PERIPHERAL_TYPE_PARFLASH,0},
RX_PARALLELFLASH_1616BIT,
{0x0089,0x0018},
{0x00000000,0x02000000,0x00040000}, /* Translation for 32MB */
0xC0000000UL, /* Base Address of FLASH where it is located in the memory map */
HalPflsInitialize_INTEL28FXXXJ3,
1, /* Number of Sectors Entries in the following FLASH sector configuration table */
{ /* Sector Entries */
{128,0x40000UL,RX_PARALLELFLASH_NO_PROTECTION},
}
}
};/*
************************************************************
* Definition of the Volume-Instances
************************************************************
*/
STATIC CONST FAR RX_VOLUME_SET_T atrXVol[] = {
{{"SYSVOLUME",RX_PERIPHERAL_TYPE_VOLUME,0}, // Set Volume A:
512*60000,
0, // Start right at byte 0 is building the first sector
12345, // Serial Number of Volume
512, // Bytes per Sector
4, // 4 Task may access to it simultaneously
Drv_FldMountFlash,
{"SYSFLASH1",RX_PERIPHERAL_TYPE_PARFLASH,0,FALSE} // Physical device to mount
}
};/*
***************************************************************************
* Peripheral Driver Configuration loaded after the Kernel has been started
***************************************************************************
*/
STATIC CONST FAR RX_DRIVER_PERIPHERAL_CONFIG_T atrXDrvCfgPost[] = {
{DrvSpiInit, RX_PERIPHERAL_TYPE_SPI, atrXSpi, MAX_CNT(atrXSpi)},
{DrvSFlsInit,RX_PERIPHERAL_TYPE_SERFLASH,atrXFlsh,MAX_CNT(atrXFlsh)},
{DrvPFlsInit,RX_PERIPHERAL_TYPE_PARFLASH,atrXPFlsh,MAX_CNT(atrXPFlsh)},
{DrvLedInit, RX_PERIPHERAL_TYPE_LED, atrXLed, MAX_CNT(atrXLed)},
{DrvVolInit, RX_PERIPHERAL_TYPE_VOLUME, atrXVol, MAX_CNT(atrXVol)}
};sendbuffer[0]='H';
sendbuffer[1]='A';
sendbuffer[2]='L';
sendbuffer[3]='L';
sendbuffer[4]='O';
recbuffer[0] = 0;
recbuffer[1] = 0;
recbuffer[2] = 0;
recbuffer[3] = 0;
recbuffer[4] = 0;
erXRes = Drv_VolIdentifyVolume("SYSVOLUME",&hSpi);
erXRes = Drv_PflIdentifyFlash("SYSFLASH1",0,&hFls);
erXRes = Drv_PflInitializeFlash(hFls);
erXRes = Drv_PflReadFlash(hFls,0,&recbuffer[0],sizeof(recbuffer));
erXRes = Drv_PflEraseFlash(hFls,0,sizeof(recbuffer));
erXRes = Drv_PflReadFlash(hFls,0,&recbuffer[0],sizeof(recbuffer));
erXRes = Drv_SflWriteFlash(hFls,0,&sendbuffer[0],sizeof(sendbuffer));
erXRes = Drv_PflReadFlash(hFls,0,&recbuffer[0],sizeof(recbuffer));
On the line Drv_PflInitializeFlash i get follwing return value: 0x4008 "DRV_PFLS_UNKONW_VENDOR"
What is wrong in the configuration ?
Br,
Rainer
HI MT,
I want only write data to the Parallel Flash and Read data for test the Parallel flash.
I have configure the SRAM0 over the sdram_config
IF ( %board == %board_nxdb500sys )
{
%write("using paired k4s561632")
DWORD AT 0x00100144 = 0x03C13261
DWORD AT 0x00100140 = 0x030D0121
%write("using paired Intel Strata Flashes (2x16)")
DWORD AT 0x00100100 = 0x0203030F
}
Br,
Rainer
Rainer
HI MT,
After i have not configure a Volume
/*
***************************************************************************
* Peripheral Driver Configuration loaded after the Kernel has been started
***************************************************************************
*/
STATIC CONST FAR RX_DRIVER_PERIPHERAL_CONFIG_T atrXDrvCfgPost[] = {
{DrvSpiInit, RX_PERIPHERAL_TYPE_SPI, atrXSpi, MAX_CNT(atrXSpi)},
{DrvSFlsInit,RX_PERIPHERAL_TYPE_SERFLASH,atrXFlsh,MAX_CNT(atrXFlsh)},
{DrvPFlsInit,RX_PERIPHERAL_TYPE_PARFLASH,atrXPFlsh,MAX_CNT(atrXPFlsh)},
{DrvLedInit, RX_PERIPHERAL_TYPE_LED, atrXLed, MAX_CNT(atrXLed)},
//{DrvVolInit, RX_PERIPHERAL_TYPE_VOLUME, atrXVol, MAX_CNT(atrXVol)}
};
i get an error in line Drv_PflErraseFlash(hFls,0,sizeof(recbuffer));
Errorcode = 400D
Br,
Rainer
Hilscher Gesellschaft für Systemautomation mbH
I've tried the following example and it works OK on a NXDB500-SYS.
No error was returned from any of these functions.
Settings were as follows:
//setup pflash timings on CS0 data.set ASD:0x100100 %LONG 0x0201000E//setup sram timings on CS1
data.set ASD:0x100104 %LONG 0x01030007//setup SDRam Timing
data.set ASD:0x100140 %LONG 0x0
data.set ASD:0x100144 %LONG 0x03C23151
data.set ASD:0x100140 %LONG 0x030D0121
config.c
#include "rX_Includes.h" /* Standard Includes */ #include "netXregs.h"extern void* g_pvFWParam;
void TestTask(void* pvParam);STATIC CONST FAR RX_HWTIMER_SET_T atrXHwTim[] = {
{{"SYSTIMER",RX_PERIPHERAL_TYPE_TIMER,0}, /* System Timer */
0, /* use GPIO_counter0 */
1000, /* 1000 microseconds = 1msec */
TRUE, /* Continuous Mode */
TRUE, /* Interrupt enabled */
FALSE,
RX_HWTIMER_TRIGGER_NONE,
0,
0
}
};STATIC CONST FAR RX_INTERRUPT_SET_T atrXInt[] = {
{{"SYSTIMER",RX_PERIPHERAL_TYPE_INTERRUPT,0}, /* System Timer interrupt */
SRT_NETX_VIC_IRQ_STAT_timer0, /* Use external Timer0 Interrupt */
29, /* Priority 29 */
RX_INTERRUPT_MODE_SYSTEM,
RX_INTERRUPT_EOI_AUTO, /* EOI self by RX */
RX_INTERRUPT_TRIGGER_RISING_EDGE,
RX_INTERRUPT_PRIORITY_STANDARD,
RX_INTERRUPT_REENTRANCY_DISABLED,
},
};STATIC CONST FAR RX_PERIPHERAL_CONFIG_T atrXCfg[] = {
{RX_PERIPHERAL_TYPE_TIMER,atrXHwTim,MAX_CNT(atrXHwTim)},
{RX_PERIPHERAL_TYPE_INTERRUPT,atrXInt,MAX_CNT(atrXInt)},
};STATIC CONST FAR RX_STATIC_TASK_T FAR atrXStaticTasks[] = {
{"TestTask", /* Set Identification */
TSK_PRIO_34, TSK_TOK_34, /* Set Priority,and Token ID */
0, /* Set Instance to 0 */
0, /* Pointer to Stack */
1024, /* Size of Task Stack */
0, /* Threshold to maximum possible value */
RX_TASK_AUTO_START, /* Start task automatically */
TestTask, /* Task function to schedule */
NULL, /* Function called when Task will be deleted */
0, /* Startup Parameter */
{0,0,0,0,0,0,0,0} /* Reserved Region */
},
};STATIC CONST FAR RX_PARALLELFLASH_SET_T atrXPFlsh[] = {
{ {"SYSFLASH1",RX_PERIPHERAL_TYPE_PARFLASH,0},
RX_PARALLELFLASH_1616BIT,
{0x0089,0x0018},
{0x00000000,0x02000000,0x00040000}, /* Translation for 32MB */
0xC0000000UL, /* Base Address of FLASH where it is located in the memory map */
HalPflsInitialize_INTEL28FXXXJ3,
1, /* Number of Sectors Entries in the following FLASH sector configuration table */
{ /* Sector Entries */
{128,0x40000UL,RX_PARALLELFLASH_NO_PROTECTION},
}
}
};STATIC CONST FAR RX_DRIVER_PERIPHERAL_CONFIG_T atrXDrvCfgPost[] =
{
{DrvPFlsInit,RX_PERIPHERAL_TYPE_PARFLASH,atrXPFlsh,MAX_CNT(atrXPFlsh)},
};RX_ENTERKERNEL_PARAM_T trXEnterKernelParam=
{
/* CPU clock rate */
100000000,/* Timer interrupt task priority */
{TSK_PRIO_DEF_RX_TIMER, 1024},/* Pointer to static Task-List */
{atrXStaticTasks, MAX_CNT(atrXStaticTasks)},/* Pointer to rx kernel modules list */
{0, 0},/* Pointer to the Peripherals-List */
{atrXCfg, MAX_CNT(atrXCfg)},/* Pointer to the Post Peripherals-List / LoadDrivers included into */
{atrXDrvCfgPost, MAX_CNT(atrXDrvCfgPost)},/* Pointer to optional Jump Table */
{NULL, 0},/* Callback for special initialization */
NULL,/* Pointer to the Middleware List */
{0, 0},/* Scheduler component (if another scheduler is desired) */
0,/* Cache enable flags */
{FALSE, FALSE},
{FALSE},
NULL,
{0x18000} /* MMU TTB (16kB) located at physical address 0x18000 */
};INT main (void)
{
volatile RX_FATAL erXFat; /* Fatal Error value, in case function would return */
/* Boot the Kernel by using the set Call-Pointer and hand over the static Task-List and the Peripherals-List */
erXFat = rX_SysEnterKernelExt(&trXEnterKernelParam);/* We should never return to here */
while(erXFat!=RX_OK);
return(0); /* Prevent Compiler warning because of non-void function */
}
testtask.c
#includestatic unsigned char recbuffer[32];
static unsigned char sendbuffer[32];void TestTask(void* pvParam)
{
RX_HANDLE hPflash = NULL;
RX_RESULT eRes;
eRes = Drv_PflIdentifyFlash("SYSFLASH1", 0, &hPflash);
eRes = Drv_PflInitializeFlash(hPflash);
eRes = Drv_PflReadFlash(hPflash, 0, &recbuffer[0], sizeof(recbuffer));
eRes = Drv_PflEraseFlash(hPflash, 0, sizeof(recbuffer));
eRes = Drv_PflReadFlash(hPflash, 0, &recbuffer[0], sizeof(recbuffer));
eRes = Drv_PflWriteFlash(hPflash,0, &sendbuffer[0], sizeof(sendbuffer));
eRes = Drv_PflReadFlash(hPflash,0, &recbuffer[0], sizeof(recbuffer));
while(1)
{
rX_SysSleepTask(1000);
}
}
Regards
MT
HI MT,
Thank you for your help. It works ! :lol:
HI Gordon,
Thank you. I have already get the right configuration.
Br,
Rainer
M T
Hilscher Gesellschaft für Systemautomation mbH
I assume you did not initialize the SRAM0 Bus where the flash is connected to. See "SramBusInit" function for details or manually initialize the SRAM controller located at physical address 0x100100.
But when I look at your configuration it seems that you want to use a file system on the parallel flash. Currently there is no support for a file system on parallel flash (as stated in the documentation).
Regards
MT