[En-Nut-Discussion] What is my error ??

Remi Bilodeau remi.bilodeau at gmail.com
Sat Oct 30 00:28:06 CEST 2010


Maybe some configuration (nutconf) I don't understand, help me if you can, I
continue to search for solution. The chip is AT45DB161 on SPI of a
AT91SAM7S256 and CS is 0 (hardware NPCS0 on PA11)

This code work:

    /* INITIALIZE DATAFLASH */
    if ((at45db = At45dbInit(SPI0_BASE, 0)) == -1) {
     puts("Dataflash init FAIL.");

    } else {
     printf("Dataflash init OK.\n");
printf("Page size is %u bytes\n",At45dbPageSize(at45db));
printf("Page number: %u\n",(unsigned int)At45dbPages(at45db));
    }

while(1) {
if(At45dbPageRead(at45db, 0, Buf, At45dbPageSize(at45db))) printf("Error
reading page 0\n"); else printf("Succesfully read page 0.\n");
        NutSleep(125);
};


This code don't work:
    if (UFlashAttach(&devUFlash0, &flashAt45dib0, &spiBus0At91)) {
        puts("Attaching serial flash failed, formating...");
if(UFlashFormat(&devUFlash0, &flashAt45dib0, &spiBus0At91)) puts("Format
fail.");
    } else puts("Attaching serial flash: OK!");

    if (NutRegisterDevice(&devUFlash0, 0, 0)) {
        puts("Mounting UFLASH0 failed");
    } else {
        puts("Mounting UFLASH0: OK!");
    }



More information about the En-Nut-Discussion mailing list