GithubHelp home page GithubHelp logo

elehobica / pico_fatfs Goto Github PK

View Code? Open in Web Editor NEW
32.0 32.0 5.0 1.63 MB

FatFs library for Raspberry Pi Pico

License: BSD 2-Clause "Simplified" License

CMake 0.06% C 99.51% C++ 0.43%
exfat fatfs raspberry-pi-pico

pico_fatfs's People

Contributors

elehobica avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pico_fatfs's Issues

Patch to support optional use of the Pico RTC for filesystem timestamps

Hi all,

I can't issue a proper pull request at the moment, but it's a really simple patch for tf_card.c so I'll just put it here for now:

DWORD get_fattime (void)
{
	datetime_t t;
	if (rtc_get_datetime(&t))
	{
		return (((t.year - 1980) << 25) + (t.month << 21) + (t.day << 16) + (t.hour << 11) + (t.min << 5) + (t.sec >> 1));
	}
	else
	{
		// Quoting the FatFs documentation, see http://elm-chan.org/fsw/ff/doc/fattime.html :
		// "The get_fattime function shall return any valid time even if the system does not support
		// a real time clock. If a zero is returned, the file will not have a valid timestamp."
		return (((2024 - 1980) << 25) + (1 << 21) + (1 << 16)); // -> 2024, January 1, 00:00:00
	}
}

...plus the associated Pico SDK #include and target_link_library for hardware_rtc elsewhere of course.

Thanks,

BR//Karl @xoblite

Default CLK_FAST is 50 MHz

In tf_card.c around line 49 the CLK_FAST speed is set to 50MHz. I believe this is unrealistic for most SD cards in SPI mode (~20MHz is max?). It was too fast to function on my wired test setup, I changed it to 100KHz and all my bugs went away.

Clarify license & terms

Ahoy!

Thank you for putting together this project- you seem to have done the legwork that's otherwise missing to get SD-card support compatible with the Pico SDK.

In lieu of reinventing the wheel I'd like to re-use your tf_card.c and tf_card.h files, building them and FatFS into libraries as part of our collection of Pico examples/drivers. Could you clarify the license, please?

I've put together an example based around this for serving files from SD card over a wireless network (using an ESP32 pack for the Pico). See: pimoroni/pimoroni-pico@24fa369

(I noticed your Pico Wav Player is BSD 2-Clause and includes a possibly more up-to-date version of this code!)

CS is low during 80 clock ticks init

In tf_card.c in disk_initialize around line 285 CS is taken LOW before sending the 80 dummy clocks. Everything I've read says CS should be high during init. I commented out CS_LOW().

Logic level shifting breakout cannot mount SD card - mount error 3

Hello,

Firstly many thanks for developing the library.
I seem to have found an issue to get the SD card to mount without error. I'd assumed this was due to my poor wiring or pin selection. However having tried an alternate pico-fatfs library this works without issue, writing Hello World to the SD card (viewable on another device). This is currently setup on a breadboard with a mess of wires, so expect poor signaling but attempting to lower CLK_FAST to as low as 1 MHZ has not helped. I've tried switch SPI lanes and pins to no avail either. The SD card reader used is this and is hooked up-to the 5v rail for power.

Any ideas how to debug a mount error 3?

Doubt it would change anything, but I've set the example code test/main.cpp to use USB serial out for debugging.

SPIx as a define

The project currently depends on SPI0. I changed this to a define because I'm using SPI1. Not a big issue, but I'm now out of sync with the master branch. I'd suggest a SPIx neutral naming convention with a define for the spi unit used.

SPI0_TX and SPI0_RX needs to be pull-ed up with 10Kohm

I see this quite frequently on the web, but I think this is not strictly the case. I believe a pull up is only needed on MISO (RX), the spec is 100k to 50k (or similar, see the fatfs docs). During the low speed initialization the SD card DO pin is in open drain mode. This needs the pull up to provide the HIGH level. After initialization though it goes into push pull mode and the pull up is no longer needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.