-
-
Notifications
You must be signed in to change notification settings - Fork 31
Added raw QSPI functionality for the Arduino Giga #224
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, a few remarks below. But on a more general note, why did you need any of the changes in the Giga variant folder? The only thing I think was required was defining a generic qspi_flash
, but it can be done with a simple one-liner:
qspi_flash: &n25q128a1 {};
everything else should be already set up in the upstream board. Can you double check please?
- Get flash information (size, sector size, page size) | ||
|
||
|
||
### Device Tree Setup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure the following part is relevant for Arduino users, only a selected few know about any of this 🙂
Maybe you can move this info to a more specific file, such as README.zephyr.md
?
#define QSPI_FLASH_DEVICE DEVICE_DT_GET(QSPI_FLASH_NODE) | ||
#else | ||
#define QSPI_FLASH_DEVICE NULL | ||
#warning "QSPI flash device not found in device tree" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#warning "QSPI flash device not found in device tree" | |
#warning "No QSPI flash available on this board" |
flash_dev = QSPI_FLASH_DEVICE; | ||
|
||
if (!device_is_ready(flash_dev)) { | ||
flash_dev = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use either NULL
or nullptr
in the file for consistency.
return false; | ||
} | ||
|
||
return device_is_ready(flash_dev); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not verify the device can accept more commands, but simply that it's enabled and has passed init()
. Since this is already tested in begin
, IMO it's better to return true
here.
Device Tree Configuration (
variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay
):pf10
pg6
pd11
,pd12
,pe2
,pf6
qspi_flash
device node with:st,stm32-qspi-nor
Board Configuration (
variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf
):CONFIG_FLASH=y
CONFIG_FLASH_STM32_QSPI=y
(corrected from invalidCONFIG_SPI_STM32_QSPI
)CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
Library (
libraries/QSPI
)bool begin()
- Initialize QSPI flashbool read(uint32_t address, void* data, size_t size)
- Read databool write(uint32_t address, const void* data, size_t size)
- Write databool erase(uint32_t address, size_t size)
- Erase sector/blocksize_t getFlashSize()
- Get total flash sizesize_t getSectorSize()
- Get erase sector sizesize_t getPageSize()
- Get write page sizebool isReady()
- Check if flash is readybool isValidAddress(uint32_t address, size_t size)
- Validate address rangevoid end()
- Deinitialize** Example Sketch**('libraries/QSPI/examples')
Initialises flash storage, erases sectors, reads and writes in a loop.