problem mapping NAND flash to PC through USB_MSC
I just made a FS_USB_MSC project and I wanted to access the flash from my windows computer.
when I use RAM space for the STORAGE_Read_FS and STORAGE_Write_FS I can Access the RAM without any problem. and also I can format the space in windows to be able to access it.
but when I use HAL_NAND functions the windows says "windows was unable to complete the format". the fucntions that I wrote to access the flash memory are :
*************************************************************************
int8_t STORAGE_Read_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
{
/* USER CODE BEGIN 6 */
pAddressz = (NAND_AddressTypeDef){blk_addr%64,0,blk_addr/64}; //page,plane,block
if(HAL_NAND_Read_Page_8b(&hnand1, &pAddressz, buf, blk_len) != HAL_OK){
return USBD_FAIL;
}
return (USBD_OK);
/* USER CODE END 6 */
}
/**
* @brief .
* @param lun: .
* @retval USBD_OK if all operations are OK else USBD_FAIL
*/
int8_t STORAGE_Write_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
{
/* USER CODE BEGIN 7 */
pAddressz = (NAND_AddressTypeDef){blk_addr%64,0,blk_addr/64}; //page,plane,block
if(HAL_NAND_Write_Page_8b(&hnand1, &pAddressz, buf, blk_len) != HAL_OK){
return USBD_FAIL;
}
return (USBD_OK);
/* USER CODE END 7 */
}
**********************************************************************
pls help find the problem.
