Flashx device problem on MQX 3.5 and MCF52259

cancel
Showing results for 
Search instead for 
Did you mean: 

Flashx device problem on MQX 3.5 and MCF52259

Jump to solution
3,272 Views
sav
Contributor I

Hi,

We have updated from MQX 3.4 to MQX 3.5 and got a problem - FlashX device doesn't work.

We used M52259DEMO board and example from "...\Freescale MQX 3.5\mqx\examples\flashx" with Code Warrior 7.2.

On MQX 3.4 (Code Warrior 7.1.2) everything was fine (my code and the example).

Here the example output:

 

MQX Flash Test Program
Beginning read/write tests
Flash device flashx: opened
Flash Device Identity: 0x00000013, 0x00000004, 0x0000006d
The BASE_ADDRESS: 0x13000
Number of sectors: 4
The WIDTH: 32
There are 4 sectors in Block 1
Block 1 Sector Size: 4096 (0x1000)
Total size of the Flash device is: 16384 (0x4000)
Erasing entire chip (this will take a while)
FLASH_IOCTL_ERASE_CHIP failed.

 

And here my "user_config.h":

------------------------------------------------

/* mandatory CPU identification */
#define MQX_CPU                 PSP_CPU_MCF52259

/*
** BSP settings - for defaults see mqx\source\bsp\<board_name>\<board_name>.h
*/
#define BSPCFG_ENABLE_TTYB       0
#define BSPCFG_ENABLE_ITTYB      0
#define BSPCFG_ENABLE_I2C0       0
#define BSPCFG_ENABLE_I2C1       0
#define BSPCFG_ENABLE_SPI0       0
#define BSPCFG_ENABLE_RTCDEV     1
#define BSPCFG_ENABLE_GPIODEV    1
#define BSPCFG_ENABLE_ADC        1
#define BSPCFG_ENABLE_FLASHX       1

#define MQX_USE_TIMER            1
#define MQX_KERNEL_LOGGING       1
#define MQX_MONITOR_STACK        1

#define BSPCFG_RX_RING_LEN       4
#define BSPCFG_TX_RING_LEN       2

/*
** board-specific MQX settings - see for defaults mqx\source\include\mqx_cnfg.h
*/

#define MQX_USE_LWMSGQ           1
#define MQX_USE_LWEVENTS         1
#define MQX_USE_MESSAGES         1
#define MQX_HAS_TIME_SLICE       1

#define MQX_USE_LWTIMER          0

/*
** board-specific RTCS settings - see for defaults rtcs\source\include\rtcscfg.h
*/

#define RTCSCFG_ENABLE_ICMP      1
#define RTCSCFG_ENABLE_UDP       1

#define RTCSCFG_ENABLE_TCP       1
#define RTCSCFG_ENABLE_STATS     1
#define RTCSCFG_ENABLE_GATEWAYS  1
#define FTPDCFG_USES_MFS         1
#define RTCSCFG_ENABLE_SNMP      1

#define TELNETDCFG_NOWAIT        FALSE

/*
** include common settings
*/

/* use the rest of defaults from small-RAM-device profile */
#include "small_ram_config.h"

/* and enable verification checks in kernel */
#include "verif_enabled_config.h"

 

------------------------------------------------

 

Can everyone help me?

 Thanks
0 Kudos
1 Solution
162 Views
PavelM
NXP Employee
NXP Employee

Hi,

It is a bug in MQX 3.5. and it will be fixed in next release.

 

You can fix it by followed steps:

1. open the file [your_MQX_installation]\src\mqx\source\io\flashx\freescale\flash_mcf52xx.c

2. find the mcf52xx_ram_function function

3. remove #if 0 and #endif lines

 

View solution in original post

0 Kudos
6 Replies
163 Views
PavelM
NXP Employee
NXP Employee

Hi,

It is a bug in MQX 3.5. and it will be fixed in next release.

 

You can fix it by followed steps:

1. open the file [your_MQX_installation]\src\mqx\source\io\flashx\freescale\flash_mcf52xx.c

2. find the mcf52xx_ram_function function

3. remove #if 0 and #endif lines

 

View solution in original post

0 Kudos
162 Views
sav
Contributor I

Hi,

 

Thanks a lot!

Problem was fixed by your steps.

0 Kudos
162 Views
CarlFST60L
Senior Contributor II

Dam, I wish I had seen this a day earlier!

 

Is there a developers email list so we be notified when MQX issues are found? New release's released etc?

 

Also, I updated my applicaiton as above and everything works, however, the MQX3.5 flashx example always returns null when doing fopen("flashx:", NULL);

0 Kudos
162 Views
elrot
Contributor I

Hi,

 

I adjusted the code as suggested, removing the #if and #endif, however, my flash card is not recognized.

 

"Unable to open flash device flashx"

 

User config is the same as shown further up. Any more suggestions? I tried two different CF cards.

 

Best Regards,

Elmar

0 Kudos
162 Views
elrot
Contributor I

OK. I have to add that I forgot to recompile the whole library using build_libs.mcp after making changes to the user_config.h. This solves at lest the compact flash card recognition.

 

However the application terminates after doing some operations so that I cannot put it to use. This is what hyperterminal produces:

 

MQX Flash Test Program
Beginning read/write tests
Flash device flashx: opened
Flash Device Identity: 0x00000013, 0x00000004, 0x0000006d
The BASE_ADDRESS: 0xf000
Number of sectors: 4
The WIDTH: 32
There are 4 sectors in Block 1
Block 1 Sector Size: 4096 (0x1000)
Total size of the Flash device is: 16384 (0x4000)
Erasing entire chip (this will take a while)

Testing with 2048 (0x800) byte buffer, block 0, sector 9216 (0x2400)
Seek to sector and modify (may take a while)
Compare OK


Testing with 4096 (0x1000) byte buffer, block 0, sector 9216 (0x2400)
Seek to sector and modify (may take a while)
Compare OK


Testing with 4096 (0x1000) byte buffer, block 0, sector 12288 (0x3000)
Testing _io_ioctl erase_sector: 12288 (0x3000)
Seek to sector and modify (may take a while)
Compare OK


Testing with 4096 (0x1000) byte buffer, block 0, sector 12288 (0x3000)
Testing _io_ioctl erase_sector: 12288 (0x3000)
Seek to sector and modify (may take a while)
Compare OK


Testing with 2048 (0x800) byte buffer, block 0, sector 10240 (0x2800)
Seek to sector and modify (may take a while)
Compare OK

Flash closed.
Flash device flashx: opened
Sector cache disabled.

Testing with 41 (0x29) byte buffer, block 0, sector 10240 (0x2800)
Compare OK

Write 41 bytes to to same place without cache
Compare OK

Sector cache enabled.
Testing with 41 byte buffer, write to address 0x29
Compare OK

Sector cache disabled.
Testing with 41 byte buffer, write to address 0x29

*** This test should end with error ***

Failed to write flash, size returned:-1 expected 41
TEC:0x0 FERROR:0xA03

 

Is this built into the project?

 

0 Kudos
162 Views
CarlFST60L
Senior Contributor II

That is the normal output of the project.

 

I still have this strange problem where the MQX3.5 flashx example will not open the flashx driver even after a full rebuild, however, it works fine in my application... I have no real need to track down the cause of this as the driver works fine in my application, but I guess it must be something in the project settings somewhere...

0 Kudos