Skip to content

Support SPI flash chips for CIRCUITPY, using non-DMA SPI for now. #465

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

Merged
merged 1 commit into from
Nov 28, 2017

Conversation

dhalbert
Copy link
Collaborator

Implemented and tested on Metro M0, Metro M4, and Feather M0 Express.

Note that if you install this, you'll lose access to your old CIRCUITPY drive in internal flash.

A few changes to shared_dma.c, but that work was interrupted to try using non-DMA SPI first. SPI baud rate calculation moved to new file peripherals.c, since it can be shared between SAMD21 and SAMD51.

storage module turned on, but not tested in detail.

@dhalbert dhalbert requested a review from tannewt November 28, 2017 02:04
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One super minor thing.

@@ -29,6 +29,5 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) },
{ MP_ROM_QSTR(MP_QSTR_FLASH_CS), MP_ROM_PTR(&pin_PA13) },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why delete this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted it because it looked like something you might have added for debugging. There are no other named pins for the flash chip (e.g., no FLASH_SCK, etc.). And there were no similar named pins on the Feather M0, so I thought it was just for testing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that may be a hangover from when the SPI bus was shared. Should the others be added or this deleted?

Copy link
Collaborator Author

@dhalbert dhalbert Nov 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd leave it deleted for now because end-user use of these pins will mess up CIRCUITPY support. If we had some API for enabling/disabling CIRCUITPY on the flash chip, then someone could use the flash chip for something else besides a filesystem, but right now it's dedicated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Approved!

@@ -38,7 +39,9 @@ void common_hal_storage_remount(const char* mount_path, bool readonly) {
mp_raise_OSError(MP_EINVAL);
}

if (mp_msc_enabled) {
// TODO(dhalbert): is this is a good enough check? It checks for
// CDC enabled. There is no "MSC enabled" check.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine it'd be enough. It shouldn't require a serial connection to be true.

#include "extmod/vfs.h"
#include "extmod/vfs_fat.h"
=======
>>>>>>> WIP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay!

@dhalbert dhalbert merged commit 93978bc into adafruit:master Nov 28, 2017
@dhalbert dhalbert deleted the 3.0_spi_flash branch November 28, 2017 20:03
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

Successfully merging this pull request may close these issues.

2 participants