FATFS+AT45: at45dbx_mem.h no such file

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm trying to mount a fat filesystem on a custom board with an AT45DBX memory chip. The uC is ATSAMR21E18

 

There is no example on FATFS+AT45DBX, only USB or MMC. If I open one of those examples and change the conf_access.h file (and include the AT45DBX module, of course), I get the error:

 

at45dbx_mem.h: No such file or directory

 

//! @{
#define LUN_0                DISABLE //!< On-Chip Virtual Memory.
#define LUN_1                ENABLE //!< AT45DBX Data Flash.
#define LUN_2                DISABLE //!< SD/MMC Card over SPI.
#define LUN_3                DISABLE //!< SD/MMC Card over MCI Slot 0.
#define LUN_4                DISABLE
#define LUN_5                DISABLE
#define LUN_6                DISABLE
#define LUN_7                DISABLE
#define LUN_USB              DISABLE  //!< Host Mass-Storage Memory.
//! @}

If the conf_access.h has the option to use AT45DBX I imagine that the .h is somewhere included, but I can't find it. Anyone knows how to solve this? 

 

Thanks,

Jorge

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Trying to figure this out as well for XMega-A3BU Xplained.  Dean Cameron confirmed that ASF Wizard doesn't list any AT45DBX stuff, and that led me to copy the files from ASF...components/memory/at45dbx.c,.h, and _hal_spi.h in one of the AT45DB sample projects.  But conf_access.h is looking for at45dbx_mem.h so now I'm all confused.  Again.

 

[Edit]  Ok, can someone please tell me how to download at45dbx_mem.c and .h   I can see the source as an html, but where can I download the actual files?  I have ASF 3.34.1... 

Field the chicken, ignore the ball.

Last Edited: Wed. Jul 26, 2017 - 02:35 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

[Lost the post, so here is  a retype]

 

No, There seems to be no module in ASF to add that is a driver for the AT45DBX. But there is a complete "Example project" for the board you have and AT456DBX. You could "nick" the files from there.

 

 

fsykes wrote:
But conf_access.h is looking for at45dbx_mem.h so now I'm all confused.

 

It's the other way around. Get some sleep ;-) at45dbx_mem.h/.c is looking for (#including) conf_at45dbx.h . This file will also be in the example project.

 

EDIT: And you'll find more dependencies..

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Wed. Jul 26, 2017 - 06:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Johan.  Yeah, that's what I thought and I loaded the example project before posting (sorry for the cross post, I will delete the later). 

The example projects pull the spi drivers for the device, but not the memory access drivers at45dbx_mem.c,.h.

I even pulled the ASF USB MSD into the project, no help.

I have successfully hooked USB MSD and FATFS to SD/MMC, AND to one of our boards with a 128k Ramtron/Cypress FRAM, but thought I would save a little time this way. 

(Sad face).  

Perhaps this is a new feature of AS7.1417, ASF 3.34.1, or Atmel Kits 7.0.98...ugh.

Thanks for reaching out again man - you guys are the best!

 

 

[EDIT]

Oh, this is what I meant by conf_access.h looking for at45dbx_mem.h...

(in conf_access.h...)

/*! \name LUN 1 Definitions
 */
//! @{
#define AT45DBX_MEM                             LUN_1
#define LUN_ID_AT45DBX_MEM                      LUN_ID_1
#define LUN_1_INCLUDE                           "at45dbx_mem.h"
#define Lun_1_test_unit_ready                   at45dbx_test_unit_ready
#define Lun_1_read_capacity                     at45dbx_read_capacity
#define Lun_1_unload                            NULL /* Can not be unloaded */
#define Lun_1_wr_protect                        at45dbx_wr_protect
#define Lun_1_removal                           at45dbx_removal
#define Lun_1_usb_read_10                       at45dbx_usb_read_10
#define Lun_1_usb_write_10                      at45dbx_usb_write_10
#define Lun_1_mem_2_ram                         at45dbx_df_2_ram
#define Lun_1_ram_2_mem                         at45dbx_ram_2_df
#define LUN_1_NAME                              "\"AT45DBX Data Flash\""
//

 

Field the chicken, ignore the ball.

Last Edited: Wed. Jul 26, 2017 - 02:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry for mixing and messing the filenames..

 

Yes, it might well be that Atmel has thrown the at45dbx_mem.c file out and replaced it with at45dbx.c . Don know, but it might well be.

 

Glad you got it sorted despite the confusion, though!

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I used the example and ported it t SD card without any issues.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, no problem about the filenames.  As for sorting it out, I haven't quite yet got there. I'm still need the at45dbx_mem.c and .h    They are listed in the ASF 3.34.1 documentation, here: http://asf.atmel.com/docs/3.34.1/xmegaau/html/files.html (image below - two files at the bottom).  I'm using ASF 3.34.1 but cannot find the right example project or ASF module to get them loaded. 

 

 

 

 

 

Field the chicken, ignore the ball.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Fianawarrior.  The SD Card stack is not the problem, that works great.  I'm trying to use the AT45DB642D data flash stack on an XMega-A3BU Xplained board and just need the two driver files mentioned above. 

Field the chicken, ignore the ball.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For whoever may wander these hallowed, empty halls, and wonder about how this all turned out...I stooped to copying the source text off of this website's published pages, and then yes, deleted the line numbers. http://simplemachines.it/martin/mizar32/1.6.0-AT32UC3/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX/EXAMPLE/DOC/html/a00024.html

Thank you, Martin, whoever you are, at "Simplemachines", whatever that is, for dropping the popcorn along this trail of tears.  I curse the evil that denied me the fruit of my quest, and slay my mouse in your honor.

Field the chicken, ignore the ball.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You folks do know that ASF is a .git repository don't you? If you need access to the files in it just git checkout a copy of the whole thing!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
You folks do know that ASF is a .git repository don't you?

Yes. (But it's a server directory w/o a woeking area, as I understand it. Anyone know how to do a checkout from such without cloning?)

 

clawson wrote:
If you need access to the files in it just git checkout a copy of the whole thing!

Yes, but from the actual file searched for:

00015 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.

 

And from the ASF repo:

C:\Users\johan\atmel\asf\Asf>git log --format="%s %ci %h"
WARNING: terminal is not fully functional
asf-3.34.1 2017-02-20 05:15:43 +0100 5a3557f
asf-3.33.0 2017-02-20 05:08:42 +0100 26f8d81
asf-3.32.0 2017-02-20 05:01:47 +0100 e1b8308
asf-3.31.0 2017-02-20 04:54:54 +0100 20927de
asf-3.30.1 2017-02-20 04:48:12 +0100 5a69a21
asf-3.29.0 2017-02-20 04:41:27 +0100 80a6b82
asf-3.28.1 2017-02-20 04:34:37 +0100 b4e3820
asf-3.27.3 2017-02-20 04:28:21 +0100 bc08906
asf-3.27.0 2017-02-20 04:22:16 +0100 cdbdbb6
asf-3.26.0 2017-02-20 04:16:13 +0100 ab02933
asf-3.25.0 2017-02-20 04:10:05 +0100 fdb031b

I guess one could go through them one after the other. Given "2009" I'd start at the rear end.

 

Side Q: Why doesn't Atmel insert ASF version number into the source files?

 

SideQ: Why did Atmel commit everything with the date/time of the build of the repo instead of forcing the actual dates.

 


 

Memory serves me slowly, but IIRC there is a provision in Studio to switch between different versions of ASF. Looking for it, it seems to be well hidden.. And again, had we known the version of the file(s) in question...

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, I cloned the repo so to get a "working area". Turns out the file(s) are still present in the latest ASF version/commit:

C:\Users\johan\atmel>git clone "C:\Program Files (x86)\Atmel\Studio\7.0\Extensions\atmel\as-asf-vsix\7.0.745\Repository\Asf.git"
Cloning into 'Asf'...
done.
Checking out files: 100% (41190/41190), done.

C:\Users\johan\atmel>cd asf

C:\Users\johan\atmel\Asf>git log --format="%s %ci %h"
WARNING: terminal is not fully functional
asf-3.34.1 2017-02-20 05:15:43 +0100 5a3557f
asf-3.33.0 2017-02-20 05:08:42 +0100 26f8d81
asf-3.32.0 2017-02-20 05:01:47 +0100 e1b8308
asf-3.31.0 2017-02-20 04:54:54 +0100 20927de
asf-3.30.1 2017-02-20 04:48:12 +0100 5a69a21
asf-3.29.0 2017-02-20 04:41:27 +0100 80a6b82
asf-3.28.1 2017-02-20 04:34:37 +0100 b4e3820
asf-3.27.3 2017-02-20 04:28:21 +0100 bc08906
asf-3.27.0 2017-02-20 04:22:16 +0100 cdbdbb6
asf-3.26.0 2017-02-20 04:16:13 +0100 ab02933
asf-3.25.0 2017-02-20 04:10:05 +0100 fdb031b

C:\Users\johan\atmel\Asf>git checkout 5a3557f
Note: checking out '5a3557f'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 5a3557f... asf-3.34.1

C:\Users\johan\atmel\Asf>dir /s /b at45dbx_mem.c
C:\Users\johan\atmel\Asf\common\components\memory\data_flash\at45dbx\at45dbx_mem.c
C:\Users\johan\atmel\Asf\common\components\memory\data_flash\at45dbx\_asf_v1\at45dbx_mem.c

C:\Users\johan\atmel\Asf>dir /s /b at45dbx_mem.h
C:\Users\johan\atmel\Asf\common\components\memory\data_flash\at45dbx\at45dbx_mem.h
C:\Users\johan\atmel\Asf\common\components\memory\data_flash\at45dbx\_asf_v1\at45dbx_mem.h

C:\Users\johan\atmel\Asf>

Which of those do we want? How do they differ? Well..

C:\Users\johan\atmel\Asf>cd common\components\memory\data_flash\at45dbx

C:\Users\johan\atmel\Asf\common\components\memory\data_flash\at45dbx>diff at45dbx_mem.c _asf_v1\at45dbx_mem.c
1c1,2
< /**
---
> /*****************************************************************************
>  *
4c5
<  * \brief CTRL_ACCESS interface for the AT45DBX data flash driver.
---
>  * \brief CTRL_ACCESS interface for the AT45DBX data flash controller.
6c7
<  * Copyright (c) 2011-2016 Atmel Corporation. All rights reserved.
---
>  * Copyright (c) 2014-2016 Atmel Corporation. All rights reserved.
42c43
<  */
---
>  ******************************************************************************/
70d70
<
77d76
< static bool b_at45dbx_unloaded = false;
81,84c80
<       if (b_at45dbx_unloaded) {
<               return CTRL_NO_PRESENT;
<       }
<       return (at45dbx_mem_check() == true) ? CTRL_GOOD : CTRL_NO_PRESENT;
---
>   return (at45dbx_mem_check() == true) ? CTRL_GOOD : CTRL_NO_PRESENT;
90c86
<       /* FATFS sector size 512Byte. */
---

      [...]

C:\Users\johan\atmel\Asf\common\components\memory\data_flash\at45dbx>

Looking at the first function in those two versions of the file, and comparing with the code in the page fsykes points to it seems the file

...  common\components\memory\data_flash\at45dbx\_asf_v1\at45dbx_mem.c

is the one wanted. (And of-course the corresponding .h file.) I've attached both files in a ZIP.

 

The question, of-course, is: Why use something as old as ASF version 1 for what seems to be a new project?

 

Attachment(s): 

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Thu. Jul 27, 2017 - 11:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
Why use something as old as ASF version 1 for what seems to be a new project?
+1

 

Actually there's a more fundamental question here and that is "why use AT45 for FAT at all?"

 

The difference between SD/MMC and AT45 is that the former contains an "intelligent controller". It will do bad block avoidance and remapping and will handle wear levelling and stuff like that. AT45 offers none of this. Sure you can configure it so that 256 byte pages have 8 additional bytes each and 512 byte pages have 16 additional bytes and you can use these to implement an ECC on each block stored so you can then detect (perhaps even correct?) the odd bit error. But ultimately you will want bad block avoidance and wear levelling so you need to add a whole new software layer on top of the base array storage driver. So you can no longer connect FAT to AT45 but FAT->FFS (Flash Filing System)->AT45 where FFS handles bad blocks and wear.

 

Just seems too complex to me - let an SD/MMC controller handle all that "hidden stuff" for you!

Last Edited: Thu. Jul 27, 2017 - 11:49 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ha!  Thank you, gentlemen, for unraveling this.  Johan - you're too much.  You didn't have to do all that work, but I am truly grateful.  I'll go "git" the lastest version!  And Clawson, I'm on the fence with you because you're a ball, er, balloon buster!  You just revealed why I shouldn't do this (and probably why Atmel Command Central decided to bury these files).  So, thanks a lot, hope you're happy.  You're absolutely right about the benefits of a card, but your joy is short lived because I'm doing it anyway!   (sniff) I just want to (sniff) make some instruments for my sailboat (sniff) and had one of these XMega-A3BU's Xplained lying around, and well, it has that chip on board, and it looked so easy, and I've had such great fun with all the xmega stuff, and (sniff)... well, I just want to record some wind data, speed, gps, and, ... .  Ok, I promise to not let lives depend on it and to only write to it while sailing. On Wednesdays Sundays.  And I will eventually hack in a card.  There.  I feel absolved of my guilt.  Now, off to "git" a couple of files.  Chow!

Field the chicken, ignore the ball.

Last Edited: Thu. Jul 27, 2017 - 08:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

fsykes wrote:
Johan - you're too much.  You didn't have to do all that work, but I am truly grateful. 

Well, sometimes when I do "too much" it is because I anticipate learning (or repeating/freshing) a few bits here and there myself during the process. This time I did. Win-win. (-:

 

And the text volume does not reflect the work. Most of it is output. My input commands are "merely"

C:\Users\johan\atmel>git clone "C:\Program Files (x86)\Atmel\Studio\7.0\Extensions\atmel\as-asf-vsix\7.0.745\Repository\Asf.git"
C:\Users\johan\atmel>cd asf
C:\Users\johan\atmel\Asf>git log --format="%s %ci %h"
C:\Users\johan\atmel\Asf>git checkout 5a3557f
C:\Users\johan\atmel\Asf>dir /s /b at45dbx_mem.c
C:\Users\johan\atmel\Asf>dir /s /b at45dbx_mem.h
C:\Users\johan\atmel\Asf>cd common\components\memory\data_flash\at45dbx
C:\Users\johan\atmel\Asf\common\components\memory\data_flash\at45dbx>diff at45dbx_mem.c _asf_v1\at45dbx_mem.c

smiley

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Johan - thanks again for the git tutorial.  I never used git before, so I used git gui to clone the repository and found the latest versions I needed.  I think it will finally build, after I fix all of my other porting errors.  I will finally have some time to work on this, but it wouldn't have been possible without your help.  I'm sure I'll be switching over to using an SD/MMC down the road, but this should work for REV A.  Thanks again man!

Field the chicken, ignore the ball.