Update on my issues. msconn crashing was, as suggested, inadequate stack size. Default was 768, and changing to 2048 and it no longer crashes. This was my first experience of stack issues with NuttX.
I have now merged the 10.2 release and building and running OK. Msconn now allows my board to be seen as a USB device and Windows recognises the connection. Since I had formatted the flash with nxffs, Windows wouldn't mount it of course so I have moved on to use FAT instead. >On 12/22/21, Alan Carvalho de Assis <acas...@gmail.com> wrote: Here the issue is because FAT sector is always 512 bytes, but your Flash is 256, >you can modify the menuconfig to let the MTD export/convert it as 512. > I found that just making the menuconfig change was not enough. There is a (seemingly) undocumented s512_initialize function I stumbled across: FAR struct spi_dev_s *spi; FAR struct mtd_dev_s *mtd_raw; FAR struct mtd_dev_s *mtd; mtd_raw = m25p_initialise(spi); mtd = s512_initialize(mtd_raw); Giving (from my bringup code): m25p_initialize: dev: 0x200773b0 m25p_readid: priv: 0x200773d0 m25p_readid: manufacturer: 20 memory: ba capacity: 19 m25p_initialize: Return 0x200773d0 Successfully bound SPI0 CS1 to the SPI FLASH driver s512_initialize: mtd: 0x200773d0 m25p_ioctl: cmd: 1537 m25p_ioctl: blocksize: 256 erasesize: 65536 neraseblocks: 512 m25p_ioctl: return 0 s512_initialize: Return 0x20077400 Successfully implemented 512 byte sector conversion ftl_initialize_by_path: path="/dev/mtdblock0" s512_ioctl: cmd: 1537 s512_ioctl: blocksize: 512 erasesize: 512 neraseblocks: 65536 s512_ioctl: return 0 Successfully initialised ftl layer This allows me to at least attempt to mkfatfs on my 32Mbyte flash device, but I am still hitting problems, so I worry I am not implementing 512 sector support properly? Or something else I yet again have missed? If I enable sub-sector erase (the memory supports 4k subsector erase) then mkfatfs crashes out: [lots of successful operations] m25p_pagewrite: page: 0000000f offset: 00000f00 m25p_waitwritecomplete: Complete m25p_writeenable: Enabled m25p_pagewrite: Written arm_dataabort: Data abort. PC: 200316bc DFAR: 6000008b DFSR: 00000005 up_assert: Assertion failed at file:armv7-a/arm_dataabort.c line: 161 task: init If I disable sub-sector erase it behaves differently: [lots of successful operations] m25p_pagewrite: page: 000000ff offset: 0000ff00 m25p_waitwritecomplete: Complete m25p_writeenable: Enabled m25p_pagewrite: Written mkfatfs_devwrite: ERROR: write failed: size=512 pos=512 error=-13 arm_dataabort: Data abort. PC: 20032044 DFAR: 01b4f430 DFSR: 00000005 up_assert: Assertion failed at file:armv7-a/arm_dataabort.c line: 161 task: init The error looks to be no write permissions? Any thoughts, anyone?