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

102 commits

Author SHA1 Message Date
Mark Haslinghuis
605fb7bb8f
[4.4.2] Revert NVIC SPI priority (#12795) 2023-05-13 08:04:35 +10:00
Mark Haslinghuis
167bd0f3d0
[4.4.2] If CS is asserted between transfers then consider bus to be busy for … (#12784)
If CS is asserted between transfers then consider bus to be busy for all but owning device (#12604)

* If CS is asserted between transfers then consider bus to be busy for all but owning device

* Track if MAX7456 is mid DMA transfer, not simply that the SPI bus is busy

* Enable SPI DMA TX/RX together

Co-authored-by: Steve Evans <SteveCEvans@users.noreply.github.com>
2023-05-12 23:39:00 +02:00
Dominic Clifton
ba71dfe6d3
BF 4.4.1 rollup 1 (#12306)
* NVIC - Update ELRS and SPI atomic_block usage to use appropriate
priority levels.

* SD - Use SDIO by default if target uses USE_SDCARD_SDIO.
2023-02-07 23:22:16 +01:00
Dominic Clifton
738ed32cff
Improve performance for ELRS SX1280 SPI callbacks and SPI/ELRS handlers. (#11460)
* SPI - Mark the SPI IRQ handler as FAST_IRQ_HANDLER.

Since it's used by both the gyro code, at 8k (or 2x8k on dual gyro
boards) having it in RAM removes a significant amount of potential flash
latency.

It is also used by the ELRS SPI code.  The ELRS code runs at 500hz, but
each cycle uses multiple SPI transfers, for clear irq, read,
start-recieving, change-frequency, etc. I.e. invokd at least 1000hz in
addition to gyro reads.

* ELRS - Move some frequently used functions to RAM and mark some irq
handlers as FAST.

* SPI/LL - Move some frequently called code to FAST_CODE.

Also remove some invalid characters that Eclipse with encoding as UTF-8
complained about.

* SPI - Mark the spiRx and spiTx dma handlers as FAST_IRQ_HANDLER.

* Filter - move nullFilterApply out of FAST_CODE.

Since it doesn't do anything, it doesn't need to be fast.  Instead we
keep more `fast` RAM for other code that really benefits from being in
fast RAM.

There is a slight penalty to jump into slower RAM.

* Gyro - Move `performGyroCalibration`out of 'fast' ram.

On F7X2 it was being inlined, saved 478 bytes of ITCM.

* Prevent handling of crash recovery handling, not detection of crash
recovery, from being inlined to save ITCM for code that runs more
frequently.
2023-01-11 06:33:06 +11:00
J Blackman
c5468981e6
Merge pull request #11897 from SteveCEvans/spi2_gyro_flash
Fix chaining of FLASH SPI transactions
2022-10-18 07:31:41 +11:00
Steve Evans
b18a114e45 Make SPI access chaining more resilient to driver coding errors as fixed in 8474a6eb 2022-10-16 19:57:00 +01:00
KarateBrot
ddf1d46549 Remove old style definitions 2022-10-13 03:33:54 +02:00
Steve Evans
92e50d548f Do not automatically negate CS at end of SPI transfer 2022-09-16 17:26:37 +01:00
Steve Evans
701b0ae55c Remove F1 and F3 support 2022-06-14 19:10:13 +01:00
Steve Evans
fc8640154a Interrupt/DMA driven SX1280 interaction for ELRS 2022-02-28 19:50:36 +00:00
Steve Evans
727d3e7daf Only allocate DMA streams for SPI_MOSI 1/SPI_MISO 1 if enabled on F4 2022-01-08 17:45:43 +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
44e45ddc84 Implement queuing of SPI request segments 2022-01-06 01:18:17 +00:00
Steve Evans
5ef34f79d5 Allow for HALF/NOMINAL/DOUBLE frequency of MAX7456 SPI clock 2022-01-06 01:18:17 +00:00
Martin Luessi
d464dd7378 SPI: fix compilation on F4 when DSHOT_BITBANG is not used 2021-12-27 12:02:41 -08:00
haslinghuis
4b44378b4d
Merge pull request #10694 from hydra/bf-spi-fixes-1
Fix missing SPI5/6 configuration.
2021-12-18 00:33:51 +01:00
Steve Evans
ab1baccc66 Track state execution time for OSD, baro, rx and GPS tasks and inform scheduler of next state execution time 2021-12-17 15:40:01 +00:00
Steve Evans
e8bf78178b No space in sizeof() as per Betaflight coding standard 2021-12-15 01:23:34 +00:00
Steve Evans
246a02dcc1 Support SPI MOSI/MISO DMA stream assignment
Add SPI_TX/SPI_RX aliases for SPI_MOSI/SPI_MISO for dma command
Only assign SPI DMA before motors on F4/F7
2021-12-12 16:35:59 +00:00
Steve Evans
71f8eb866f Check for bus number 0 in spiSetBusInstance() 2021-12-01 22:21:31 +00:00
Dominic Clifton
b8c4f7308a Fix missing SPI5 and SPI6 configuration.
* Missing SPI5/SPI6 devices.
* Support SPI5/6 on the STMH743 unified target.

There were no defaults for the `SPI_FULL_RECONFIGURABILITY` option.
2021-10-10 16:56:52 +02:00
Steve Evans
7ef7795944 Support dual gyros sharing a common SPI bus 2021-10-05 17:40:21 +01:00
Michael Keller
80be08f050 Added resource allocation for DMA. 2021-09-28 02:44:07 +13:00
Steve Evans
ab66795eeb G4 SPI DMA support 2021-08-31 23:29:51 +12:00
Michael Keller
f4d840f5f8 Changed naming of SPI DMA resources to reflect the SPI bus number. 2021-07-28 00:55:55 +12: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
Steve Evans
41a0ca43d1 Run SPI FLASH at full speed 2020-10-27 00:17:34 +00:00
mikeller
386be8d742 Added registration for bus devices. 2020-07-08 21:34:31 +12:00
mikeller
6f92a1ce13 Fixed handling of SPI parameters for Unified Targets. 2019-11-24 22:10:08 +13:00
jflyper
82c978a828 [H7] Enable SPI with resurrected HAL-based driver from v3.1.7 2019-05-10 10:53:12 +09:00
jflyper
343e9b3a67 Allow mixed speed and mode on a SPI bus by CR1 caching 2019-01-14 03:34:27 +09:00
jflyper
6307277d50 Refactor sdcard_spi.c to use busDevice_t (again) 2018-10-04 18:36:05 +09:00
jflyper
0a16f4dc90 Refactor rx_spi with spiBusXXX API 2018-10-01 22:54:47 +09:00
jflyper
4193890b27 Handle NULL SPI instance case 2018-09-16 03:09:45 +09:00
mikeller
2feae20c32 Replaced instances of '#include <platform.h>' with '#include "platform.h"'. 2018-05-24 23:46:19 +12: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
be7c8e384e Merge remote-tracking branch 'betaflight/master' into bfdev-spi-refactor 2017-11-23 14:47:12 +09:00
jflyper
608d56160d Refactor SPI 2017-11-23 11:10:14 +09:00
Michael Keller
c431939552
Merge pull request #4530 from martinbudden/bfa_accgyro_mpu
Remove accgyro mpu read and write function pointers
2017-11-14 21:12:59 +13:00
jflyper
8296990774 Revert #4565 2017-11-13 16:51:09 +09:00
Martin Budden
03d1409fd2 Remove accgyro mpu read, write and ISR update function pointers 2017-11-13 07:18:59 +00:00
jflyper
e5e5846a74 Refactor SPI 2017-11-13 10:45:01 +09:00
jflyper
75f8e49a9a All SPI are fed with same clock (36MHz) on F1 and F3 2017-08-23 22:40:34 +09:00
jflyper
6936601415 Undefine BR_BITS for safety 2017-08-21 16:19:40 +09:00
jflyper
67a44c4636 Clock divisor for SPI2 and SPI3 must be halved 2017-08-21 11:23:09 +09:00
Martin Budden
2fd20c2bd9 Rename SPI functions. Rationalise parameter order. 2017-07-20 16:22:59 +01:00
jflyper
d2c71a6f7e Add bus parameters to barometerConfig_t, cli handling 2017-07-16 23:57:16 +09:00
jflyper
52d447d2ef Configurable baro (BMP280)
- busDevice_t is now has a discriminator.
- busDevice_t is added to baroDev_t.
- BMP280 I2C and SPI drivers are consolidated.
2017-07-15 18:05:56 +09:00
jflyper
84da61ff19 Changes per @ledvinap 's comment 2017-07-11 18:43:59 +09:00