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

Using 1-bit mode when loading file from SD #55

Open
MarianoDesivo opened this issue Jul 28, 2021 · 8 comments
Open

Using 1-bit mode when loading file from SD #55

MarianoDesivo opened this issue Jul 28, 2021 · 8 comments

Comments

@MarianoDesivo
Copy link

MarianoDesivo commented Jul 28, 2021

On my protoboard, the 4-bit mode does not work

So I use the 1-bit mode when working on C++ (which works at any speed)

Is it possible to use the 1-bit mode on Oopsy?

/** Sets whether 4-bit mode or 1-bit mode is used for the SDMMC */

enum class BusWidth

{
    BITS_1, /**< Only 1 bit of data per clock is transferred */

    BITS_4, /**< 4-bits of parallel data for each clock pulse */

};
@grrrwaaa
Copy link
Contributor

From a quick test here, that does seem to work.

I've pushed that change to the dev branch, i fyou want to try it.

@MarianoDesivo
Copy link
Author

I can't find where to set 1-bit mode or 4-bit mode

@grrrwaaa
Copy link
Contributor

Ah -- you can try checking out the dev branch of Oopsy using git, and building from there (replacing your current installation of Oopsy).

Or, since it is such a simple change, you can just go into the file /source/genlib_daisy.h, and in the function sdcard_init(), just before the line handler.Init(sdconfig);, add the code:

sdconfig.width = daisy::SdmmcHandler::BusWidth::BITS_1;

@stephenhensley
Copy link
Collaborator

This is something we'll probably want to be configurable either through the bpatcher or the board-definition json. The difference in performance is pretty substantial.

That said when breadboarding stuff it can be hard to get 4-bit working at the fastest speeds. It can also be preferable to use the 1-bit, and have the extra 3 pins available for other things.

@grrrwaaa
Copy link
Contributor

Ah -- that makes sense. OK, when we move the SDcard setup to the JSON we can configure it there.

BTW, there was another user saying they were having intermittent failure when loading multiple files at startup -- sometimes it would read them all, sometimes only a few of them. Could that be related? (I think the user post was in the Slack for Daisy/Oopsy)

@stephenhensley
Copy link
Collaborator

Hmm, not sure. Could be. Do you remember if they were using the patch or were wiring something up themselves?

If we're loading stuff into RAM and not directly processing it, then it doesn't really matter too much (just the difference in initial load time), but if we add any sort of file streaming directly from the SD card then it would start to matter a bit more.

@MarianoDesivo
Copy link
Author

@grrrwaaa I downloaded the dev branch as you said

I checked the genlib_daysi.h (it is 1-bit mode)

void sdcard_init() {
			daisy::SdmmcHandler::Config sdconfig;
			sdconfig.Defaults(); // 4-bit, 50MHz
			// sdconfig.clock_powersave = false;
			// sdconfig.speed           = daisy::SdmmcHandler::Speed::FAST;
			sdconfig.width           = daisy::SdmmcHandler::BusWidth::BITS_1;
			handler.Init(sdconfig);
			dsy_fatfs_init();
			f_mount(&SDFatFS, SDPath, 1);
		}

On that folder, I opened oopsy-dev\examples\sdcard-minimal.maxpat

I run it on my daysi but does not work (I copied the drumloop.wav on my SD)

I checked with C++ (WavPlayer.cpp with 1-bit mode) and it works, playing drumloop.wav on my daisy

@MarianoDesivo
Copy link
Author

BTW, there was another user saying they were having intermittent failure when loading multiple files at startup -- sometimes it would read them all, sometimes only a few of them. Could that be related? (I think the user post was in the Slack for Daisy/Oopsy)

I think you are talking about this one

#16 (comment)

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

No branches or pull requests

3 participants