Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AT45DB041D interfacing with arduino Uno #24

Open
tshivamiitk7 opened this issue Jun 7, 2018 · 9 comments
Open

AT45DB041D interfacing with arduino Uno #24

tshivamiitk7 opened this issue Jun 7, 2018 · 9 comments
Assignees
Labels

Comments

@tshivamiitk7
Copy link

Hi, i am trying to interfacing AT45DB041D with arduino uno.
I am trying to upload pagetest code from your library, but i am unable to get any result on serial monitor i am getting 0 value for all outputs.

@BlockoS
Copy link
Owner

BlockoS commented Jun 8, 2018

  • Did you power the dataflash with 3.3V ?
  • Did you check that the pin values for SPI (SS, CS, MISO, MOSI, etc...) are correct ?
  • In pagetest if you remove the content of the loop function, did you get the status register and chip info right ?

@BlockoS BlockoS self-assigned this Jun 8, 2018
@BlockoS BlockoS added the bug label Jun 8, 2018
@tshivamiitk7
Copy link
Author

tshivamiitk7 commented Jun 8, 2018

Hi,
Thanks for your reply, and yes yes i powered the dataflash with 3.3V.
The pin values for SPI are as below:
Dataflash Arduino Uno
Vcc -- 3.3 V
Gnd -- Gnd
MISO -- Pin 11
MOSI -- Pin 12
SCK -- Pin 13
CS -- Pin 10
In pagetest if i am removing the content of loop function, still i am not getting the right value.
I am attaching a snapshot of my output function.
capture
@BlockoS

@BlockoS
Copy link
Owner

BlockoS commented Jun 8, 2018

🤦‍♂️ doh... I just noticed this in pagetest source code:

/* Initialize dataflash */
  dataflash.setup(5,6,7);

This means that CS is on pin 5.
Ok so.. to make it work with your configuration just do:

dataflash.setup(10);

@tshivamiitk7
Copy link
Author

Hi,
I have checked the SPI pin connections again and now i am getting the output as attached in the picture below:
Can you give me some explaination of the code or any relevant link where i can understand what your code is doing.
Also provide me some guidance on my next goal.
My task is to acquire the data from microcontroller's ADC and store it in the memory and read it from the memory using commands and USB.
capture2

@tshivamiitk7
Copy link
Author

Hi, i have done that already in dataflash.setup(10,6,7). I guess there was a problem with my MISO & MOSI connections.
What are the functions of pin 6&7.

@BlockoS
Copy link
Owner

BlockoS commented Jun 8, 2018

Ok. Normally you should get "@ write test 0" etc.. but it seems that the behaviour of Serial.print has changed since I wrote this example.
You may replace it with Serial.write.

Anyway, this example writes a string starting at offset 0 of the buffer 1.
Then the content of the buffer is transferred to a page (the page index is incremented at each loop).
Afterwards when all the pages have been used, the content of these pages are read using alternatively pageToBuffer and bufferRead (the content the page is transferred to one of the buffer then this buffer is set to be read) or pageRead where the is directly read (leaving the content of the buffer untouched).

@tshivamiitk7
Copy link
Author

Thanks and also please let me know the changes i have to make in your code for my custom application. Is it possible to do it using your library.

@BlockoS
Copy link
Owner

BlockoS commented Jun 8, 2018

Here's an idea, each time you read a value from the ADC, you store it to in one of the Dataflash buffer. When this buffer is full (or when you receive a shutdown command) you write this buffer to a page.
Note that if you turn off your device the content of the Dataflash buffer will be lost.

At this point the way the data is organized is up to you.

About data read, it depends on the command. If it's "send me all the data" you can loop through all the pages and directly send the data.

@tshivamiitk7
Copy link
Author

Ok thank you so much, your idea seems great.
Further before the above task, i want to write 1000 numbers in a sector as a unit and then read them through a microcontroller.
Please tell what should be my approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants