Hallo,
ich habe ein NAND Flash am FMC eines STM32F446 am laufen. Bei einem Page
Write durch die HAL Funktion 'HAL_NAND_Write_Page_8b' wird nach dem
Schreiben der Status gepollt bis das NAND Flash die Daten verarbeitet
hat, das passiert mit folgendem Code:
1 | while(HAL_NAND_Read_Status(hnand) != NAND_READY)
|
2 | {
|
3 |
|
4 | if((HAL_GetTick() - tickstart ) > NAND_WRITE_TIMEOUT)
|
5 | {
|
6 | return HAL_TIMEOUT;
|
7 | }
|
8 | }
|
Die Schleife dauert bei mir ca. 276us. In dieser Zeit kommen bei mir
keine anderen Interrupts durch. Da ich zyklisch einen ADC abfrage ist
mir dies aufgefallen.
Die Funktion HAL_NAND_Read_Status sieht so aus:
1 | uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand)
|
2 | {
|
3 | uint32_t data = 0U;
|
4 | uint32_t deviceaddress = 0U;
|
5 |
|
6 | /* Identify the device address */
|
7 | if(hnand->Init.NandBank == FMC_NAND_BANK2)
|
8 | {
|
9 | deviceaddress = NAND_DEVICE1;
|
10 | }
|
11 | else
|
12 | {
|
13 | deviceaddress = NAND_DEVICE2;
|
14 | }
|
15 |
|
16 | /* Send Read status operation command */
|
17 | *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_STATUS;
|
18 |
|
19 | /* Read status register data */
|
20 | data = *(__IO uint8_t *)deviceaddress;
|
21 |
|
22 | /* Return the status */
|
23 | if((data & NAND_ERROR) == NAND_ERROR)
|
24 | {
|
25 | return NAND_ERROR;
|
26 | }
|
27 | else if((data & NAND_READY) == NAND_READY)
|
28 | {
|
29 | return NAND_READY;
|
30 | }
|
31 |
|
32 | return NAND_BUSY;
|
33 | }
|
Weiss jemand an was das liegt und wie man das beheben kann? Ich habe
schon sämtliche Datenblätter von ST durch aber nichts zu dem Thema
gefunden.
Viele Gruesse
cc