1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 04:45:24 +03:00
Commit graph

71 commits

Author SHA1 Message Date
J Blackman
fd2ac2f77f
FIX: Flash status compilation error (#12360) 2023-02-14 20:12:58 +11:00
Dominic Clifton
b3053be4dd
OctoSPI and Memory Mapped Flash support (#11825)
* STM32H730/STM32H750 - Fix use of USE_LP_UART1 instead of USE_LPUART1.

* STM32H723 - Prepare for being able to build for using non-internal-flash
config storage.

* STM32H723 - Prepare for using non-default strings.

* STM32H723 - Disable 'use custom defaults' when using USE_EXST.

* STM32H723 - Disable CUSTOM_DEFAULTS_EXTENDED when EXST is used.

* OCTOSPI - Add initialisation code.

* Add support for RAM_CODE.

* STM32H730 - Add support for RAM_CODE via the .ram_code attribute.

* OCTOSPI - Proof-of-concept for disabling/enabling memory mapped mode on
a running system.

NOTE: The HAL libs are compiled into a memory mapped region, and this cannot be used for OctoSPI access when memory mapped mode is disabled.

* OCTOSPI - Drop HAL support after determining that it's not suitable for
the memory mapped flash use-case.

* OCTOSPI - Sometimes, when disabling memory map mode, the abort fails.
Handle this by disabling the OSPI peripheral first and re-enabling it
afterwards.

* SD/FLASH - Update comments regarding possible solutions to the catch-22
issue with SD/SPI/QUADSPI/OCTOSPI pin configurations.

* OCTOSPI - Use device instance directly.

* OCTOSPI - Prepare W25Q flash driver for octospi support.

* OCTOSPI - Add octospi flash detection.

Note: The method to detect flash chips is similar to the method used for
QUADSPI and as such the code was used as a base. However the initial
OCTOSPI implementation doesn't support the non-memory-mapped use-case so
the un-tested code is gated with `USE_OCTOSPI_EXPERIMENTAL`.

The key differences are:
* uses octospi api not quadspi api.
* flash chip clock speeds should not be changed for memory-mapped flash
chips, bootloader already set it correctly.
* only certain flash chips are capable of memory mapped support.

* W25Q - Ensure w25q128fv_readRegister returns 0 if the receive fails.

* OCTOSPI - Implement octoSpiTransmit1LINE, octoSpiReceive1LINE and
octoSpiReceive4LINES.

* OCTOSPI - Specify device from init.

* OCTOSPI - More fixes and work on init.

Current status is that memory mapped mode is disabled and flash chip is
detected, but w25q128fv_detect should not be calling w25q128fv_reset.

* FLASH - Add comment regarding wasted flash space on targets that only
use one bus type for the flash chip.

* FLASH - Split `detect` into `identify` and `configure`.

* OCTOSPI - Extract flashMemoryMappedModeEnable/Disable to separate
methods.

* FLASH - Reduce size of targets that don't support the use of multiple
flash interfaces.

* Single-flash-chip targets usually only support one type of io
interface.
* Without this, compiler warnings are generated in `flashSpiInit` for
targets that only use flash chip drivers that support quadspi or octospi
that don't even use SPI for flash.

* FLASH - Use MMFLASH_CODE/DATA to conditionally move code/data to RAM.

Only targets compiled to support memory mapped flash chips need the some
specific code in RAM.  Otherwise the code/data should be in the normal
linker section.

* FLASH - W25Q Prepare for memory mapped flash usage.

* Wait/Delay functions must work with interrupts disabled.
* Code used for reading/writing must run from RAM.

* OCTOSPI - Implement remaining required methods.

* OCTOSPI - Fixes for earlier code (not last commit).

* FLASH - W25Q update timeout values from Datasheet Rev L.

* FLASH - Prepare flash driver for use when memory mapped flash is
disabled.

* System - Prepare microsISR for use when memory mapped flash is disabled.

* FLASH - Add support for CONFIG_IN_MEMORY_MAPPED_FLASH.

* Flash - Fix incorrect gating on cli flash commands.

When compiling with USE_FLASH_CHIP and without USE_FLASHFS there were
compiler warnings.

* MMFLASH - Fix release-mode build.

* FLASH - Allow SPI pins to be reconfigured when using CONFIG_IN_MEMORY_MAPPED_FLASH.

MMFLASH only works via QuadSPI/OctoSPI peripherals.

* EXST - Disable the 2GB workaround which is now causing a different
error.

The error we get with 'remove-section' enabled is:

"error in private header data: sorry, cannot handle this file".  The
cause of this new error in the objcopy codebase is an out of memory
condition, somehow the 2GB files and this error are related but the root
cause of both is still unknown.

* OCTOSPI - Add support for STM32H723.

* STM32H723 - Add linker scripts for EXST usage.

* NucleoH723ZG - Add build script to demonstrate OCTOSPI and Memory Mapped
flash support.

* FLASH - WUse the size in bits to set the size of the buffer.

* FLASH - Fix typo in W25N driver defines.

Was using W28N instead of W25N

* OCTOSPI - Fix missing semilcolon when compiling without
USE_FLASH_MEMORY_MAPPED.

* OCTPSPI - Fix missing call to 'memoryMappedModeInit'.

* SPRacingH7RF - Add example build script to allow for testing prior to
unified target / cloud-build support.
2023-02-04 06:24:01 +11:00
Martin Luessi
a56abc94a8
Flash M25P16: Add QSPI support (#12103) 2023-01-09 15:13:42 +01:00
David O'Connor
009102891e
Added Winbond W25q80 flash support (#12027)
* Added w25q80 flash support

* Changed order
2022-11-30 21:56:04 +11:00
Steve Evans
8474a6eb7d Fix chaining of FLASH SPI transactions 2022-10-16 13:21:59 +01:00
Steve Evans
ea37eca74f Add support for Winbond W25X32 FLASH 2022-04-24 14:28:37 +01:00
Steve Evans
fc8640154a Interrupt/DMA driven SX1280 interaction for ELRS 2022-02-28 19:50:36 +00:00
Steve Evans
4aab87539f Implement queuing of SPI request segments
Use union in busSegment_t as per ledvinap feedback
2022-01-06 01:18:18 +00:00
Steve Evans
5ef34f79d5 Allow for HALF/NOMINAL/DOUBLE frequency of MAX7456 SPI clock 2022-01-06 01:18:17 +00:00
Steve Evans
e8bf78178b No space in sizeof() as per Betaflight coding standard 2021-12-15 01:23:34 +00:00
Steve Evans
7ef7795944 Support dual gyros sharing a common SPI bus 2021-10-05 17:40:21 +01:00
Michael Keller
c9d7267cf9
Merge pull request #10812 from DusKing1/add-ZB25Q128-flash 2021-09-10 02:25:27 +12:00
Steve Evans
fb97b44a33 Tidy up SPI sequence indexing
Advance fdevice->currentWriteAddress in m25p16_callbackWriteComplete()
2021-09-07 00:11:49 +12:00
Steve Evans
432b80167f Added non-blocking SPI DMA support for access to FLASH for BB 2021-07-25 23:58:46 +01:00
Steve Evans
87c8847c13 New SPI API supporting DMA
Call targetConfiguration() once before config is loaded and again afterwards in case the config needs to be changed to load from SD card etc

Drop SPI clock during binding

Remove debug

Add per device SPI DMA enable

Fix sdioPinConfigure() declaration warning

Reduce clock speed during SPI RX initialisation
2021-07-25 12:40:25 +12:00
DusKing1
969123f16e Add support for Zbit ZB25Q128 flash 2021-06-23 11:45:24 +08:00
azol
2b21e2ff70 add W25Q64JVXGIM flash support 2021-04-16 14:24:54 +08:00
crteensy
dea5710b7b
Add support for S25FL064L
untested
copied S25FL128L descriptor, corrected jedecID, guessed correct sector count from W25Q64 (should be an equivalent device)
2021-03-25 22:11:58 +01:00
Steve Evans
41a0ca43d1 Run SPI FLASH at full speed 2020-10-27 00:17:34 +00:00
Dominic Clifton
b09012621b Update default flash bulk-erase timeout and improve developer
documentation regarding timeouts.
2019-06-12 12:22:07 +02:00
Dominic Clifton
6189d6bdc5 Fix Flash API timeout issues.
Flash operations can specify how long to wait before the next operation
is issued.

Prior to this the amount of time waited, and when, was wrong.

e.g.
m25p16_eraseCompletely - possibly waits ages TO START, starts, exit.
m25p16_pageProgramContinue - waits DEFAULT_TIMEOUT_MILLIS to START,
starts, exits.

m25p16_pageProgramContinue would fail to write to the flash as the
device was still busy erasing and didn't wait long enough.


what happens now is:
m25p16_eraseCompletely - waits using the current timeout, starts, sets
timeout to be `now + BULK_ERASE_TIMEOUT_MILLIS`, exits.
m25p16_pageProgramContinue - waits using the current
`BULK_ERASE_TIMEOUT_MILLIS`, starts, exists, sets timeout to be `now +
DEFAULT_TIMEOUT_MILLIS`.

Since the timeout is stored in the flashDevice_t the solution also works
for multi-die devices which use an instance of flashDevice_t for each
die.
2019-06-09 20:31:24 +02:00
Bruce Luckcuck
99a87cb34f Fix flash m25p16 driver sector erase
The sector erase function was not taking into account the address size when sending the command to the device and the erase was failing for devices using 24bit addressing.
2019-05-25 12:27:18 -04:00
Dominic Clifton
dcd138ae20 Update flash drivers to support QuadSPI
- Update flash w25n01g driver to support QuadSPI.

- flash_m25p16 update for QuadSPI support

- w25m driver update for QuadSPI support

- Use 100Mhz (ULTRAFAST) clock for QuadSPI w25n01

- Conditionalize QUADSPI code in w25n01g driver

- Use handle instead of handle_u
2019-05-17 07:35:25 +09:00
Thorsten Laux
9df9b87f44 support JEDEC_ID_WINBOND_W25Q128_DTR flash 2019-03-09 12:09:28 +01:00
jflyper
343e9b3a67 Allow mixed speed and mode on a SPI bus by CR1 caching 2019-01-14 03:34:27 +09:00
Thorsten Laux
749492c2de add support for BERGMICRO_W25Q32 2018-12-21 08:34:04 +01:00
Andrey Mironov
fd17292843 Added M25Q32 Winbond ID 2018-05-22 09:11:30 +03:00
blckmn
a9f74cd6df Removed excess trailing spaces before new lines on licenses. 2018-04-25 20:58:00 +10:00
blckmn
46fe22b4bd Direct license replacement 2018-04-22 09:22:46 +10:00
jflyper
864dba98c1 Prepare flash code for multiple device type support (#5683)
* Prepare flash drivers for multiple device type support

* Add static assertions on device page and flashfs alloc sizes.
2018-04-19 21:05:42 +12:00
Faduf
b580534eeb Add support to Cypress S25FL128L flash memory 2018-02-10 20:39:16 +01:00
mikeller
429c6cecda Moved parameter group for flash into pg/. 2017-12-24 02:21:02 +13:00
jflyper
d68757c914 Make each pageProgramContinue a separate transaction 2017-12-08 19:21:37 +09:00
Martin Budden
1482439bbe Improve bus usage in M25P16 flash 2017-11-29 09:35:16 +00:00
jflyper
f35aa97023 Changed parameter order for setAddress 2017-11-22 00:42:03 +09:00
jflyper
ecabd778f0 Use 4B address for device > 128Mb (16MB) 2017-11-21 22:20:21 +09:00
Milan Krstic
f9de9ae109 add support for Winbond W25Q16 2017-11-18 01:13:48 +01:00
mikeller
e70de9d06b Added support for the Winbond W25Q256 flash chip (32MB). 2017-10-17 17:57:37 +13:00
Martin Budden
9fe0e9eb2a Configurable FLASH 2017-07-21 17:18:51 +01:00
Martin Budden
2fd20c2bd9 Rename SPI functions. Rationalise parameter order. 2017-07-20 16:22:59 +01:00
Martin Budden
23f158913e Moved time functions out of system.h into time.h 2017-05-26 14:03:28 +01:00
Martin Budden
3e66b8edbd Flash code tidy 2017-04-25 06:05:00 +01:00
Martin Budden
2493c214b0 Created subdirectories in drivers directory 2017-04-12 08:06:22 +01:00
Martin Budden
e8d0cd1eec Preparation for conversion to parameter groups 9 2017-02-19 08:11:23 +00:00
atomiclama
a282d723ca Added a nop around the setting of the Flash CS pin.
This increases the time the CS pin is high between sequential bus
access.
Was a problem on some Revo/AirbotF4 targets. Where the timinig was more
critical due to the flash chip used.
2016-12-13 12:37:40 +00:00
blckmn
f7518203aa Initial rework - removing target specific code from main.c
Moved FLASH to masterConfig
Moved LED (named statusLeds) to masterConfig
Fixed up some targets to remove defines from main.c
2016-12-10 10:35:17 +11:00
Martin Budden
0c3ce05ec4 Merge pull request #1483 from jamming/development
Add kakuteF4-V1 target, it is designed with STM32 F4 MCU and ICM20689 IMU.
2016-11-11 10:12:11 +01:00
Martin Budden
19901730fc Removed trailing spaces from device drivers 2016-11-11 08:11:48 +00:00
blckmn
58105c25ac Simplified Owner management 2016-11-10 18:56:13 +11:00
jamming
1727d75d67 changes log 2016-11-04 16:38:48 +08:00