STM32L476RG

STM32F103 Nucleo boards e.g. STM Nucleo F103RB
User avatar
GrumpyOldPizza
Posts: 181
Joined: Fri Apr 15, 2016 4:15 pm
Location: Denver, CO

Re: STM32L476RG

Post by GrumpyOldPizza » Fri Sep 08, 2017 12:10 pm

gncemre23 wrote:
Wed Aug 30, 2017 1:14 pm
GrumpyOldPizza wrote:
Wed Jun 07, 2017 5:45 pm
gncemre23 wrote:I'm a new user of Nucleo STM32l476RG. I'm wondering what the purposes of tools->DOSFS menu in arduino ide is. Can we use for this menu for data logging with SDIO mode?
The STM32L4 core as a filesystem called DOSFS (which among other things allows stream writes, an a power safe mode). It does support SDCARD via SPI and SDIO, as well a Serial NOR flashes via QSPI (SPI mode coming; ah, yes, a NOR FTL is used there). With this option you are configuring which of the various devices is attached to DOSFS. As of right now you can only select one. Internally an early initialization is needed so that USB/MSC also can access the same storage device, as well as taking some exclusive pins out of the user accessible definitions in variant.cpp.

So yes, you can use that for data logging via SDIO. We have seen 21MB/sec read and 18 MB/sec write performance throu the filesystem with that. There are a bunch of different options for opening/creating a file in DOSFS that trades off speed vs. power.
I have been trying to use SDIO mode. I've changed the variant.cpp and variant.h looking the variant.cpp given for nucleo-dragonfly. However, not succeeded. Can you look at the codes given below, please? Should I do anything more?

Code: Select all

#include "FS.h"
#include "stm32l4_wiring_private.h"


void setup() {
  // put your setup code here, to run once:
  stm32l4_sdmmc_initialize(0);
 Serial1.begin(9600);
  
}
File dnm; 
void loop() {
  
  // put your main code here, to run repeatedly:,
  if(Serial1.read()=='k')
  {
   dnm=DOSFS.open("xxx.txt","w+");
   if(DOSFS.exists("log.txt"))
    Serial1.println("ok");
   Serial1.println("opened");
  }
  if(Serial1.read()=='l')
   {
    dnm.close();
    Serial1.println("closed");
   }
}
Sorry for the delay, my daytime job took over my life ;-)

You got all the pieces right. Did you also edit boards.txt to include the proper defines ?

gncemre23
Posts: 6
Joined: Wed May 31, 2017 10:20 pm

Re: STM32L476RG

Post by gncemre23 » Fri Sep 08, 2017 5:03 pm

GrumpyOldPizza wrote:
Fri Sep 08, 2017 12:10 pm
gncemre23 wrote:
Wed Aug 30, 2017 1:14 pm
GrumpyOldPizza wrote:
Wed Jun 07, 2017 5:45 pm


The STM32L4 core as a filesystem called DOSFS (which among other things allows stream writes, an a power safe mode). It does support SDCARD via SPI and SDIO, as well a Serial NOR flashes via QSPI (SPI mode coming; ah, yes, a NOR FTL is used there). With this option you are configuring which of the various devices is attached to DOSFS. As of right now you can only select one. Internally an early initialization is needed so that USB/MSC also can access the same storage device, as well as taking some exclusive pins out of the user accessible definitions in variant.cpp.

So yes, you can use that for data logging via SDIO. We have seen 21MB/sec read and 18 MB/sec write performance throu the filesystem with that. There are a bunch of different options for opening/creating a file in DOSFS that trades off speed vs. power.
I have been trying to use SDIO mode. I've changed the variant.cpp and variant.h looking the variant.cpp given for nucleo-dragonfly. However, not succeeded. Can you look at the codes given below, please? Should I do anything more?

Code: Select all

#include "FS.h"
#include "stm32l4_wiring_private.h"


void setup() {
  // put your setup code here, to run once:
  stm32l4_sdmmc_initialize(0);
 Serial1.begin(9600);
  
}
File dnm; 
void loop() {
  
  // put your main code here, to run repeatedly:,
  if(Serial1.read()=='k')
  {
   dnm=DOSFS.open("xxx.txt","w+");
   if(DOSFS.exists("log.txt"))
    Serial1.println("ok");
   Serial1.println("opened");
  }
  if(Serial1.read()=='l')
   {
    dnm.close();
    Serial1.println("closed");
   }
}
Sorry for the delay, my daytime job took over my life ;-)

You got all the pieces right. Did you also edit boards.txt to include the proper defines ?
That's ok. Thank you for your reply.. What should i do about board.txt?

User avatar
GrumpyOldPizza
Posts: 181
Joined: Fri Apr 15, 2016 4:15 pm
Location: Denver, CO

Re: STM32L476RG

Post by GrumpyOldPizza » Sat Sep 09, 2017 12:46 pm

gncemre23 wrote:
Fri Sep 08, 2017 5:03 pm
GrumpyOldPizza wrote:
Fri Sep 08, 2017 12:10 pm
gncemre23 wrote:
Wed Aug 30, 2017 1:14 pm

I have been trying to use SDIO mode. I've changed the variant.cpp and variant.h looking the variant.cpp given for nucleo-dragonfly. However, not succeeded. Can you look at the codes given below, please? Should I do anything more?

Code: Select all

#include "FS.h"
#include "stm32l4_wiring_private.h"


void setup() {
  // put your setup code here, to run once:
  stm32l4_sdmmc_initialize(0);
 Serial1.begin(9600);
  
}
File dnm; 
void loop() {
  
  // put your main code here, to run repeatedly:,
  if(Serial1.read()=='k')
  {
   dnm=DOSFS.open("xxx.txt","w+");
   if(DOSFS.exists("log.txt"))
    Serial1.println("ok");
   Serial1.println("opened");
  }
  if(Serial1.read()=='l')
   {
    dnm.close();
    Serial1.println("closed");
   }
}
Sorry for the delay, my daytime job took over my life ;-)

You got all the pieces right. Did you also edit boards.txt to include the proper defines ?
That's ok. Thank you for your reply.. What should i do about board.txt?
Missed that you don't have a DOSFS.begin() in setup. That should take care of the problem. Editing boards.txt would simply allow you to select a few things directly without having to put them into "setup()". Latter one should mostly work, but I would not guarantee it. Some code needs to execute before USB starts up, which is before "setup()" is called.

gncemre23
Posts: 6
Joined: Wed May 31, 2017 10:20 pm

Re: STM32L476RG

Post by gncemre23 » Mon Sep 11, 2017 11:32 am

GrumpyOldPizza wrote:
Sat Sep 09, 2017 12:46 pm
gncemre23 wrote:
Fri Sep 08, 2017 5:03 pm
GrumpyOldPizza wrote:
Fri Sep 08, 2017 12:10 pm


Sorry for the delay, my daytime job took over my life ;-)

You got all the pieces right. Did you also edit boards.txt to include the proper defines ?
That's ok. Thank you for your reply.. What should i do about board.txt?
Missed that you don't have a DOSFS.begin() in setup. That should take care of the problem. Editing boards.txt would simply allow you to select a few things directly without having to put them into "setup()". Latter one should mostly work, but I would not guarantee it. Some code needs to execute before USB starts up, which is before "setup()" is called.
I'm sorry but I don' understand completely. Where should I edit the to execute the codes before USB starts up?

gncemre23
Posts: 6
Joined: Wed May 31, 2017 10:20 pm

Re: STM32L476RG

Post by gncemre23 » Wed Sep 13, 2017 11:03 am

gncemre23 wrote:
Mon Sep 11, 2017 11:32 am
GrumpyOldPizza wrote:
Sat Sep 09, 2017 12:46 pm
gncemre23 wrote:
Fri Sep 08, 2017 5:03 pm


That's ok. Thank you for your reply.. What should i do about board.txt?
Missed that you don't have a DOSFS.begin() in setup. That should take care of the problem. Editing boards.txt would simply allow you to select a few things directly without having to put them into "setup()". Latter one should mostly work, but I would not guarantee it. Some code needs to execute before USB starts up, which is before "setup()" is called.
I'm sorry but I don' understand completely. Where should I edit the to execute the codes before USB starts up?
Finally, I have succeeded. I have been trying the SDIO 1-bit mode. When I tried the 4-bit mode, the file is created on the SD card. Thank you for your all responses.

Post Reply