You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • As you mentioned i am trying to read write protect register...
    but no luck with write operation.... Page Erase is working... reading is working.. but unable to do write() operation ...

    How do you know that page erasing is working without begin able to write?

    Fairly assuming you do no know what the memory has stored, you would need the following sequence to proof that your page erase worked, read, and write work:

    1. erase page
    2. read from page and get all 0xFF back
    3. write onto page 0x41 0x42 0x43 (=ABC=[65,66,67])
    4. read from page and get 0x41 0x42 0x43 ([65,66,67]=ABC)
    5. erase page
    6. read from page and get all 0xFF back

    In code this may look like below.

    Copy it, paste it into the IDE code pane, upload it to the board, and post the result with copy paste of the output you get in IDE console / terminal pane.

    SPI1.setup({sck:A5, miso:A6, mosi:A7,baud:4500000});
    while ((SPI1.send(0x05,A4)[0] & 1) === 1) { ""; }
    SPI1.send(0x06,A4);
    SPI1.send([0xD8,0x00,0x00,0x00],A4);
    while ((SPI1.send(0x05,A4)[0] & 1) === 1) { ""; }
    console.log(SPI1.send([0x03,0x00,0x00,0x­10,0x00,0x00,0x00],A4); // ---> 255,255,255
    SPI1.send(0x06,A4);
    SPI1.send([0x02,0x00,0x00,0x10,0x41,0x42­,0x43],A4);
    while ((SPI1.send(0x05,A4)[0] & 1) === 1) { ""; }
    console.log(SPI1.send([0x03,0x00,0x00,0x­10,0x00,0x00,0x00],A4); // ---> 65,66,67
    SPI1.send(0x06,A4);
    SPI1.send([0xD8,0x00,0x00,0x00],A4);
    while ((SPI1.send(0x05,A4)[0] & 1) === 1) { ""; }
    console.log(SPI1.send([0x03,0x00,0x00,0x­10,0x00,0x00,0x00],A4); // ---> 255,255,255
    
About

Avatar for allObjects @allObjects started