I am trying to use an external SPI flash to store my web page data on a TWRMCF52259.
I have the SPI FLASH working using the BSP's spi0 and MQX fopen ("spi0:", NULL)
I can read, write, and erase the flash using this method.
I created an io device and can do freads and fwrites on the device.
I am up up to layering on the partition manager and the install works and returns a valid partition handle.
error_code = _io_part_mgr_install(webflsh_handle, partman_name, SPI_MEMORY_PAGE_SIZE);
The fopen returns a valid handle
partman_handle = fopen(partman_name, NULL);
I am failing on the IO_IOCTL_VAL_PAR with the invalid partition error, which I think is normal since the device is erased. I also traced through the code which does a read of address 0 and then does not find the correct data to indicate a valid partition.
error_code = _io_ioctl(partman_handle, IO_IOCTL_VAL_PART, ¶m);
ERROR(0x30aa) PMGR INVALID PARTITION
Because I got INVALID_PARTITON I thought I need to set the partition first so I tried
error_code = _io_ioctl(partman_handle, IO_IOCTL_SET_PARTITION, NULL);
which returns the same error
Error creating part MGR(0x30aa) PMGR INVALID PARTITION
Does anyone know if this is how you are supposed to do it, I have not found any examples that call IO_IOCTL_SET_PARTITION and have not figured out how to format before the partition manager is running.
Thanks
Hello,
format command should set up sector 0 with default partition.
If it doesn't work, try it without using partition manager first.
PetrM