AnsweredAssumed Answered

FatFS on STM32CubeMx question ?

Question asked by H.Rick on Jan 22, 2016
Latest reply on Jan 24, 2016 by Clive One
Guys,

I tried to use HAL_SPI from STM32CubeMX with FATFs but I got this error
when I compiled the function below
argument of type "const BYTE *" is incompatible with parameter of type "BYTE *"
How can I fix it ?
DRESULT disk_write(BYTE pdrv,
  const
    BYTE *buff, DWORD sector, UINT count)
{
  DRESULT res;
    if (pdrv || !count) return RES_PARERR;
    if (Stat & STA_NOINIT) return RES_NOTRDY;
    if (Stat & STA_PROTECT) return RES_WRPRT;
  
    if (!(CardType & CT_BLOCK)) sector *= 512;  /* Convert to byte address if needed */
  
    if (count == 1) {   /* Single block write */
        if ((send_cmd(CMD24, sector) == 0)  /* WRITE_BLOCK */
            && xmit_datablock(buff, 0xFE))
            count = 0;
    }
    else {              /* Multiple block write */
        if (CardType & CT_SDC) send_cmd(ACMD23, count);
        if (send_cmd(CMD25, sector) == 0) { /* WRITE_MULTIPLE_BLOCK */
            do {
                if (!xmit_datablock(buff, 0xFC)) break;
                buff += 512;
            } while (--count);
            if (!xmit_datablock(0, 0xFD))   /* STOP_TRAN token */
                count = 1;
        }
    }
    deselect();
  
    return count ? RES_ERROR : RES_OK;
      //res = disk.drv[pdrv]->disk_write(buff, sector, count);
  //return res;
}


thanks

Outcomes