Re: [I] [HELP] STM32H723+SDMMC2+SDRAM(executing in sdram)+IDMA+FATFS,read/write file failure [nuttx]

2025-06-01 Thread via GitHub


snikeguo closed issue #16400: [HELP] STM32H723+SDMMC2+SDRAM(executing in 
sdram)+IDMA+FATFS,read/write file failure
URL: https://github.com/apache/nuttx/issues/16400


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



[I] [HELP] STM32H723+SDMMC2+SDRAM(executing in sdram)+IDMA+FATFS,read/write file failure [nuttx]

2025-06-01 Thread via GitHub


snikeguo opened a new issue, #16400:
URL: https://github.com/apache/nuttx/issues/16400

   ### Description
   usercode:
   ```
   printf("USER MAIN!!!\n");
boardctl(BOARDIOC_INIT, 0); //mount /dev/mmcsd0 ->/mnt/sd0
 printf("USER MAIN:open mnt/sd0/2.txt,O_RDWR|O_CREAT,666\n");
int fd=open("/mnt/sd0/2.txt",O_RDWR|O_CREAT,666);  
if(fd<0)
{
printf("open file error\n");
return -1;
}
 printf("USER MAIN:write mnt/sd0/2.txt,hello world\n");
 write(fd,"hello world\n",12);
 printf("USER MAIN:close fd\n");
close(fd);
   
 printf("USER MAIN:open mnt/sd0/2.txt,O_RDONLY,666\n");
 fd=open("/mnt/sd0/2.txt",O_RDONLY,666);  
if(fd<0)
{
printf("USER MAIN:open file error\n");
return -1;
}
 char buf[20];
 int readed_size=read(fd,buf,sizeof(buf));
close(fd);
 printf("readed_size=%d\n",readed_size);
   
 int ret=nx_umount2("/mnt/sd0", 0);
   
   ```
   
   console log:
   ```
   USER MAIN!!!
   stm32_sdio_initialize: Initializing SDIO slot 0
   stm32_setclkcr: CLKCR: 0003003f PWR: 0003
   stm32_reset: CLCKR: 0003003f POWER: 0003
   stm32_sdio_initialize: Bind SDIO to the MMC/SD driver, minor=0
   mmcsd_slotinitialize: minor: 0
   mmcsd_hwinitialize: DMA supported: 1
   mmcsd_hwinitialize: Attached MMC/SD interrupts
   stm32_registercallback: Register 0xc000c965(0xc08084f8)
   stm32_callbackenable: eventset: 02
   stm32_callback: Callback 0xc000c965(0xc08084f8) cbevents: 02 cdstatus: 00
   mmcsd_slotinitialize: MMC/SD slot is empty
   mmcsd_slotinitialize: MMC: /dev/mmcsd0 0KB 1-bit backwards compatibility mode
   stm32_sdio_initialize: Successfully bound SDIO to the MMC/SD driver
   stm32_sdio_initialize: Card detect : 1
   sdio_mediachange: cdstatus OLD: 00 NEW: 01
   stm32_callback: Callback 0xc000c965(0xc08084f8) cbevents: 02 cdstatus: 01
   stm32_callback: Callback to 0xc000c965(0xc08084f8)
   mmcsd_mediachange: arg: 0xc08084f8
   mmcsd_probe: type: 0 probed: 0
   mmcsd_removed: type: 0 present: 1
   mmcsd_widebus: No card inserted.
   stm32_setclkcr: CLKCR: 0003003f PWR: 0003
   stm32_setclkcr: CLKCR: 0003003f PWR: 0003
   mmcsd_probe: Card present.  Probing
   mmcsd_cardidentify: Identifying card...
   stm32_setclkcr: CLKCR: 0003003f PWR: 0003
   stm32_sendcmd: cmd:  arg: f0f0f0f0 regval: 1000 enabled irq: 

   stm32_sendcmd: cmd:  arg:  regval: 1000 enabled irq: 

   stm32_sendcmd: cmd: 0208 arg: 01aa regval: 1108 enabled irq: 

   mmcsd_cardidentify: SD V2.x card
   stm32_sendcmd: cmd: 0077 arg:  regval: 1137 enabled irq: 

   stm32_sendcmd: cmd: 0129 arg: 4010 regval: 1129 enabled irq: 

   mmcsd_cardidentify: R3: 40ff8000
   stm32_sendcmd: cmd: 0077 arg:  regval: 1137 enabled irq: 

   stm32_sendcmd: cmd: 0129 arg: 4010 regval: 1129 enabled irq: 

   mmcsd_cardidentify: R3: c0ff8000
   mmcsd_cardidentify: SD V2.x card with block addressing
   mmcsd_probe: SD version 2.x with block addressing.
   stm32_sendcmd: cmd: 00c2 arg:  regval: 1302 enabled irq: 

   mmcsd_decode_cid: mid: fe cbx: 0 oid: 32 pnm: SD prv: 0 psn: 0001ed01 mdt: 
87 crc: 53
   stm32_sendcmd: cmd: 01c3 arg:  regval: 1103 enabled irq: 

   mmcsd_sdinitialize: RCA: 0001
   stm32_sendcmd: cmd: 004d arg: 0001 regval: 110d enabled irq: 

   stm32_sendcmd: cmd: 00c9 arg: 0001 regval: 1309 enabled irq: 

   mmcsd_decode_csd: CSD:
   mmcsd_decode_csd:   CSD_STRUCTURE: 1 SPEC_VERS: 0 (MMC)
   mmcsd_decode_csd:   TAAC {TIME_UNIT: 6 TIME_VALUE: 1} NSAC: 0
   mmcsd_decode_csd:   TRAN_SPEED {TRANSFER_RATE_UNIT: 2 TIME_VALUE: 6}
   mmcsd_decode_csd:   CCC: 1461
   mmcsd_decode_csd:   READ_BL_LEN: 9 READ_BL_PARTIAL: 0
   mmcsd_decode_csd:   WRITE_BLK_MISALIGN: 0 READ_BLK_MISALIGN: 0
   mmcsd_decode_csd:   DSR_IMP: 0
   mmcsd_decode_csd:   SD Block Addressing:
   mmcsd_decode_csd: C_SIZE: 29819 SD_ER_BLK_EN: 1
   mmcsd_decode_csd: SD_SECTOR_SIZE: 127 SD_WP_GRP_SIZE: 0
   mmcsd_decode_csd:   WP_GRP_EN: 0 MMC DFLT_ECC: 0 (MMC) R2W_FACTOR: 2
   mmcsd_decode_csd:   WRITE_BL_LEN: 9 WRITE_BL_PARTIAL: 0
   mmcsd_decode_csd:   FILE_FORMAT_GROUP: 0 COPY: 0
   mmcsd_decode_csd:   PERM_WRITE_PROTECT: 0 TMP_WRITE_PROTECT: 0
   mmcsd_decode_csd:   FILE_FORMAT: 0 ECC: 0 (MMC) CRC: 78
   mmcsd_decode_csd: Capacity: 15267840Kb, Block size: 512b, nblocks: 30535680 
wrprotect: 0
   stm32_sendcmd: cmd: 0087 arg: 0001 regval: 1107 enabled irq: 

   stm32_setclkcr: CLKCR: 00031003 PWR: 0003
   stm32_sendcmd: cmd: 0050 arg: 0008 regval: 1110 enabled irq: 

   stm32_sendcmd: cmd: 0077 arg: 0001 regval: 1137 enabled irq: 
012a
   stm32_sendcmd: cmd: 0473 arg: 000

Re: [I] [HELP] STM32H723+SDMMC2+SDRAM(executing in sdram)+IDMA+FATFS,read/write file failure [nuttx]

2025-05-17 Thread via GitHub


snikeguo commented on issue #16400:
URL: https://github.com/apache/nuttx/issues/16400#issuecomment-2888237447

   ```
   static sdio_capset_t stm32_capabilities(struct sdio_dev_s *dev)
   {
 struct stm32_dev_s *priv = (struct stm32_dev_s *)dev;
 sdio_capset_t caps = 0;
   
 if (priv->onebit)
   {
 caps |= SDIO_CAPS_1BIT_ONLY;
   }
   else
   {
 caps |=SDIO_CAPS_4BIT_ONLY;  //add this code
   }
   
 caps |= SDIO_CAPS_DMABEFOREWRITE;
   
   #if defined(CONFIG_STM32H7_SDMMC_IDMA)
 caps |= SDIO_CAPS_DMASUPPORTED;
   #endif
   
 return caps;
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [I] [HELP] STM32H723+SDMMC2+SDRAM(executing in sdram)+IDMA+FATFS,read/write file failure [nuttx]

2025-05-17 Thread via GitHub


snikeguo closed issue #16400: [HELP] STM32H723+SDMMC2+SDRAM(executing in 
sdram)+IDMA+FATFS,read/write file failure
URL: https://github.com/apache/nuttx/issues/16400


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [I] [HELP] STM32H723+SDMMC2+SDRAM(executing in sdram)+IDMA+FATFS,read/write file failure [nuttx]

2025-05-17 Thread via GitHub


snikeguo commented on issue #16400:
URL: https://github.com/apache/nuttx/issues/16400#issuecomment-2888202105

   solution:
   
   CONFIG_FAT_DMAMEMORY=y
   CONFIG_GRAN=y
   CONFIG_STM32H7_SDMMC_IDMA=y
   CONFIG_ARMV7M_DCACHE_WRITETHROUGH=n see:armv7m mpu document
   
   in stm32_dmarecvsetup:
   #if defined(CONFIG_ARCH_HAVE_SDIO_PREFLIGHT)
   // DEBUGASSERT(stm32_dmapreflight(dev, buffer, buflen) == 0);
   #endif
   
   
![Image](https://github.com/user-attachments/assets/2d7b5254-76e8-4862-a80a-ed6a46340758)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]