Commit Graph

176 Commits

Author SHA1 Message Date
Matthew Kennedy d7698f6703
Dedicated code path for USB console/TS (#2465)
* new apis

* dedicated USB path

* move decl

* init

* don't init usb twice

* guard

* check that we're initialized before using TS

* comment

* guard

* guard USB

* brain doesn't go good

* make tests happy

* dead define

* cypress

* ifdef != if

* s

* include priority

* don't start a thread we know we don't need

* bad-ish merge

* const

* why did this code exist...?

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-18 14:07:22 -04:00
Matthew Kennedy 3072d54717
dead code, warnings (#2461) 2021-03-15 10:23:19 -04:00
Matthew Kennedy 5a003f8638
use full memory on STM32F42x (#2450)
* linker script

* hook it up
2021-03-13 07:26:58 -05:00
Matthew Kennedy df5403356c
fix h7 adc (#2442) 2021-03-10 19:52:39 -05:00
Matthew Kennedy 40c4238f13
enable CAN on H7 (#2393)
* enable

* guard correctly

* h7 bit timing

* allow longer frames

* allow data smaller than maximum

* mcu temperature

* typo

* tx message

* testing

* check for CAN or FDCAN

* don't need that any more

* h7 bitrate config

* undo testing

* h7-ify msg tx

* comment

* break out SID/EID macros

* guard differently

* update ChibiOS

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-09 18:54:01 -05:00
Matthew Kennedy 96a14fd649
ADC cleanup, enable oversampling on H7 (#2437)
* cleanup v2 adc

* simplify

* oversample on h7

* output 16b result

* port-ify ADC_MAX_VALUE

* simplify include

* guard for cypress

* make sim/tests happy

* 16x oversample + comment

* this check is uesless

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-08 14:50:50 -05:00
Matthew Kennedy 06e32d937a
avoid various "no connect" scenarios (#2432)
* init mmc and USB earlier

* connect USB faster
2021-03-07 20:21:42 -05:00
Matthew Kennedy b729bdbcbf
Store ini filesystem in compressed block device (#2420)
* add module

* implement compressed block device

* enable for f7/h7

* script

* stub compressed image

* implement

* call the script

* headers, comments, fix init bug

* set msd options

* update chibios-contrib

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-07 19:25:34 -05:00
Matthew Kennedy e264029fbc
STM32H7 Slow ADC (#2421)
* extract

* guard

* put some back

* put back

* slow is actually 500hz so slow is fine here

* no magic

* fix printFullAdcReport

* cast

* implement h7 adc ish

* analog switches

* bad merge

* no map avg on h7

* fix master while we're at it

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-04 20:58:56 -05:00
Matthew Kennedy f22f318bdb
Extract slow adc (#2402)
* extract

* guard

* put some back

* put back

* slow is actually 500hz so slow is fine here

* no magic

* fix printFullAdcReport

* cast

* if we turn those off is it happy

* stub cypress/kinetis

* guard fast stuff better

* bad merge

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-04 19:55:09 -05:00
Matthew Kennedy b1873b3d8b
set all thread priorities in the same place (#2412)
* unify thread priority

* header

* mmc
2021-02-28 07:30:45 -05:00
Matthew Kennedy 6fe0cadfc0
allow disabling fast ADC (#2406)
* mostly guard against no fast adc

* disable on h7

* guard more

* guard adc init

* you can't do that in c++

* we need that

* s

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-28 07:30:19 -05:00
Matthew Kennedy 520fc2b4ec
H7 flash (#2408)
* enable

* defines and mpu util

* implement flash for h7

* format
2021-02-26 17:38:17 -05:00
Matthew Kennedy 1acc1f7092
make h7 chconf like f4 (#2405)
* make h7 chconf like f4

* clean up f7 while we're at it

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-26 07:59:39 -05:00
Matthew Kennedy d7adbe5fef
maybe hook up sdmmc (#2398)
* maybe hook up sdmmc

* the complier didn't like that very much

* mcuconf

* guard properly

* fix

* duh

* omg that's an extra close paren

* explicitly set which device fatfs should use

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-25 01:37:44 -05:00
Matthew Kennedy 4fe0ceec61
deduplication in halconf (#2377)
* rusefi_halconf

* h7 gpt

* don't redefine that

* maybe this was necessary

* format

* no usb in cypress

* flags for bl

* cypress

* maybe bootloader

* no smart build for cypress/kinetis

* no smart build

* no really, disable smart build

* don't need to clean that env var

* cypress

* format
2021-02-24 14:08:03 -05:00
Matthew Kennedy 9c591c7733
don't cache temperature samples at all (#2392) 2021-02-24 08:15:03 -05:00
Matthew Kennedy 392a7539be
enable H7 spi (#2391)
* enable features

* move MMC SPI config to port

* correct word length

* related cleanup

* doesn't need nocache

* include

* enable that
2021-02-24 08:14:21 -05:00
Matthew Kennedy 86233c4e62
update h7 clock config (#2388)
* h7 clocks

* run the core at 400

* disable LSE

* 8mhz timer clock

* osc

* it has to be even slower

* something is wrong with WFI

* this was wrong anyway
2021-02-23 22:55:38 -05:00
rusefillc c836f766af would this give me h72 SD? 2021-02-18 17:04:51 -05:00
rusefillc 384113a984 would this give me h72 SD? 2021-02-18 16:16:45 -05:00
Matthew Kennedy 90ef4c93ad
merge mcuconf for f4/f7 (#2375)
* merge for f4/f7

* more

* include efifeatures

* s

* no TS serial on f7 for now

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-18 15:04:32 -05:00
Matthew Kennedy fa894d55a3
set MCU properly (#2371) 2021-02-17 15:25:57 -05:00
Matthew Kennedy 878794f9cf
properly put buffers in no-cache regions (#2357)
* configure for no cache

* this doesn't need a setting

* now we don't need invalidate

* reorder and comment

* mmc

* sw knock
2021-02-15 17:39:11 -05:00
Andrey G bb5ee69f29
RusEFI is green: put cpu in standby in idle (#2342)
* MRE is green: put cpu in standby in idle

* Revert "MRE is green: put cpu in standby in idle"

This reverts commit 62b5cadda014ace749b145b629da62b182b5e3ce.

* RusEFI is green on all boards
2021-02-14 10:24:21 -05:00
Matthew Kennedy 89391919dc
automatic switch between internal and MSD SD card (#2349)
* auto enable usb msd

* guard and turn on for proteus
2021-02-14 08:10:39 -05:00
Matthew Kennedy 56b7db8e9c
pullup (#2348) 2021-02-14 08:04:09 -05:00
Andrey G f1785fee11
Config cleanups (#2347)
* Remove duplication

* Ports: STM32F7: we want PAL_USE_CALLBACKS for F7 too
2021-02-13 18:45:33 -05:00
Matthew Kennedy 9a3f3f34b2
USB mass storage descriptor (#2330)
* enable msd

* modify descriptors for composite device

* makefile cleanup

* format

* define

* embiggen fifos

* needed that

* cleanup too while we're at it

* rename endpoints

* switchable descriptors

* guard the request hook too

* don't need this changed yet

* cleanup

* update ep0 response

* cleanup

* use the msd hook from chibios

* this was wrong

* this was covered by other PR

* this is also covered

* s
2021-02-13 08:54:08 -05:00
Matthew Kennedy d8032fbd8f
fix usb descriptor mistakes (#2340)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-13 01:06:55 -05:00
Matthew Kennedy 315360cb04
Rename USB endpoints, update ChibiOS-Contrib (#2334)
* rename endpoints

* update chibios contrib

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-12 14:21:56 -05:00
Matthew Kennedy fff734502d
turn in to a composite device (#2332) 2021-02-11 15:52:06 -05:00
Matthew Kennedy dade25ef34
move chconf/mcuconf/halconf in to hw_ports (#2321)
* move f4 config files

* don't need this

* f7

* f7

* h7

* this was duplicated

* turn off smart build

* loader too

* update prometheus paths

* bootloader should include confdir

* fix the flash size while we're at it

* move chconf_common

* use wait

* normalize board.mk

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-10 19:38:24 -05:00
Matthew Kennedy 85fab40d21
get mcu temperature within port (#2326)
* remove EFI_ADC_TEMP_SENSOR

* implement

* comment

* s

* switch adc_inputs over

* header

* s

* I think aligned-on-stack should work ok

* num channels

* cache safety

* move adc init too

* don't compile that file for the h7

* cypress & kinetis

* ports

* guard against bootloader

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-09 22:04:36 -05:00
Matthew Kennedy 2c465247e9
stm32h7 usb (#2319)
* enable

* enable

* serial number

* usb defines

* buffer size

* more stuff we can enable
2021-02-08 16:24:49 -06:00
Matthew Kennedy 435f8f7e2b
h7 flash, guard against no CAN (#2317)
* h7 flash

* guard some other stuff

* I guess it just builds now?

* maybe ci too
2021-02-08 16:24:38 -05:00
Matthew Kennedy 36483e870a
consolidate stm32 mpu util (#2314)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-08 15:52:00 -05:00
Matthew Kennedy 3debd2229b
move board.h for f7/h7 (#2316)
* f7 board.h

* h7
2021-02-08 15:46:48 -05:00
Matthew Kennedy ad07166e9d
move f4 board.h (#2313)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-08 15:29:07 -05:00
Matthew Kennedy b995e7bcaa
include board.c from hw_ports.mk (#2311)
* set mcu type in hw_ports

* move f4 linker script

* move f7 linker script

* don't set default linker file in makefiles

* extra line

* prometheus actually didn't depend on anything special for f469

* dead line

* h7

* dead

* move board.c

* set explicit cpu type for simulator

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-08 07:52:31 -06:00
Matthew Kennedy 423acd384b
simplify MCU selection (#2308)
* set mcu type in hw_ports

* move f4 linker script

* move f7 linker script

* don't set default linker file in makefiles

* extra line

* prometheus actually didn't depend on anything special for f469

* dead line

* h7

* dead
2021-02-08 02:11:44 -05:00
Andrey G 3166076839
Some fixes prior to board pull request (#2291)
* ChibiOS: add support for STM32F765

This chip is used on Subaru EG33 p'n'p RusEFI board from Dron_Gus

* drivers: gpio: mc33810: commulative update

- use BIT macro
- fix wake-up method
- fix order of arguments in _add function

* port: stm32f4/7: detectCanDevice check for enabled interfaces only

* ADC: fix internal array size

internalAdcIndexByHardwareIndex should be EFI_ADC_LAST_CHANNEL size
couse adc_channel_e is used as index

* status LEDs: support status LEDs that driven by low level
2021-02-06 12:22:57 -05:00
rusefillc 30358e0526 reducing code duplication 2021-02-06 00:46:40 -05:00
rusefillc cda053f388 H7 compilation #2284 2021-02-06 00:37:12 -05:00
rusefillc 4dbb77415a reducing code duplication 2021-02-06 00:25:13 -05:00
rusefillc a093a839be reducing code duplication 2021-02-06 00:18:47 -05:00
rusefillc e4a85acb3b H7 compilation #2284 2021-02-05 23:37:18 -05:00
rusefillc 908dbd640c let's build for h7 2021-02-05 22:10:59 -05:00
rusefillc 9d77a35b5a let's build for h7 2021-02-05 21:09:36 -05:00
Matthew Kennedy 198bdec496
USB reports real STM32 Serial Number (#2254)
* mpu util data

* implementation
2021-01-30 14:51:11 -05:00
rusefillc e1febfb9e1 fixing port I 2021-01-25 00:29:48 -05:00
rusefillc c069f1c959 fixing port I 2021-01-22 23:31:21 -05:00
rusefillc aaa9f2a608 Hellen needs text representation of GPIOI
H7 dreams are asking for J and K
2021-01-22 01:25:05 -05:00
rusefi 0dc0ae19be OMG we are not using java yet?! 2021-01-18 19:00:53 -05:00
rusefi bb1ae49534 https://refactoring.com/catalog/replaceMagicLiteral.html 2021-01-18 18:54:18 -05:00
Andrey G 25560b85c2
Supress annoing unused warnings (#2216) 2021-01-11 08:49:20 -05:00
rusefillc 4f49c73a45 Lcd fix (I hope) #2211
there is still an issue :(
2021-01-09 17:30:39 -05:00
Andrey G 7803968621
Lcd fix (I hope) (#2211)
* LCD: check if settings are valid on each access

* Lada Kalina: remove duplicate code

All LCD pins are set to GPIO_UNASSIGNED in disableLCD()

* Remove duplicate code

* We still need to know when invalid gpio is used...

This reverts commit c17775231a.
2021-01-09 17:16:10 -05:00
rusefillc c17775231a dron0gus please help 2021-01-09 15:31:09 -05:00
Andrey G 2af32084f4
gpio helper (#2195)
* gpios: isBrainPinValid helper

* LCD HD44780: do not touch pins if DM_NONE or invalid gpio

* Fix isEnabled checks for GPS and Joystick

* LCD HD44780: writePad use this method wider
2021-01-08 20:01:26 -05:00
Andrey G f96ae7525f
Gpio cleanup #2 (#1530)
* pin repository: PIN_USED size in now equal to brain_pin_e enum size

expect special values...

* smart gpios: register gpio chip to given base (no auto-allocation)

* drivers: gpio: core: add gpiochip_unregister()

* drivers: gpio: MC33810 intergation

* smart_gpio.cpp: cleanup ifdef mess, minor cleanups

* gpio: core: additional check for gpio ranges overlaps

* unit test: gpio chip: fixed and extended
2021-01-06 18:29:47 -05:00
Matthew Kennedy 8ad2080df7
switch stm32 scheduling to use PWM driver (#1983)
* move to folder

* extract hardware part of microsecond_timer

* dead ST forum link

* de-volatile

* simulator build

* guard

* switch stm32 to pwm timer

* comments

* f7 mcuconf

* simulator

* guard

* warning

* header, cleanup

* constant

* less magic

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-11 00:44:40 -05:00
Matthew Kennedy 6334e5011f
Port-ify microsecond_timer hardware implementation (#1964)
* move to folder

* extract hardware part of microsecond_timer

* dead ST forum link

* de-volatile

* simulator build

* guard
2020-11-22 20:39:32 -05:00
rusefillc 5678190d5a ADC: fixes: #1979
better error handling?
2020-11-22 13:42:24 -05:00
Matthew Kennedy f3b7a1d9da
Remove lockAnyContext, replace with CriticalSectionLocker (#1938)
* switch to CriticalSectionLocker

* that's just about all

* clean up last usage

* include hpp for sim

* need the cpp wrappers in the makefile too

* include dir

* include
2020-11-19 06:56:02 -05:00
Matthew Kennedy 8241b0aef6
consolidate to common (#1962) 2020-11-18 16:22:19 -05:00
Matthew Kennedy 5d3d85d644
put getTimeNowLowerNt in to mpu_util (#1950)
* put getTimeNowLowerNt in to mpu_util

* move GPTDEVICE to port_mpu_util

* and remove from efifeatures
2020-11-18 14:17:00 -05:00
andreika-git 6e5a3fbbe9
Hellen says fix cypress build (#1818)
* fix compilation

* fresh generated files

* more files

Co-authored-by: Andrei <andreikagit@users.noreply.github.com>
2020-09-23 14:06:22 -04:00
rusefi 33eef982d1 reorder ADC channel index #1763
we forgot about something
2020-09-20 14:20:08 -04:00
rusefi e1be439682 Hellen says merge #1772 helping merge - Kinetis?! 2020-09-09 16:38:18 -04:00
rusefi 6e64d243da Hellen says merge #1772 helping merge 2020-09-09 14:35:01 -04:00
rusefi 07bc8100c7 Hellen says merge #1772 helping merge 2020-09-09 14:20:54 -04:00
rusefi 59ecf525f5 Hellen says merge #1772 helping merge 2020-09-09 13:43:18 -04:00
rusefi 47b3ad0b9c Hellen says merge #1772 more ports 2020-09-09 08:58:12 -04:00
rusefi 4acea75cc8 Hellen says ports 2020-09-07 11:57:20 -04:00
dron0gus 182747e907
Adc cleanups (#1743)
* ADC: remove ADC_TwoSamplingDelay*

1. it is related to double or triple interlived mode only
2. it should be writen to CCR register, not CR1

* ADC: use designated initializers
2020-09-01 07:38:35 -04:00
dron0gus 6992a541f3
stm32/kinetis_pins.cpp: remove PORTS array - duplicates ports array (#1527) 2020-06-21 15:59:18 -04:00
Matthew Kennedy 3a7c6f242b
Hardware pwm (#1283)
* hard pwm

* fix, comments

* PC6-9 and PD12-15

* PB6-9

* dynamic frequency

* f7 mcuconf

* format

* relocate to common, support variable frequency

* error handling

* oops

* fix test build

* noop kinetis

* better guards

* guard for bl

* guards don't work if they have typos

* more mapping

* oops

* don't use for slow pwm

* enable pwm

* guard properly

* save a little memory

* use less mem

* correct timers

* all your ram are belong to us

* update limit & comment

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-05-28 16:02:41 -04:00
rusefi 1387ea7582 helping build 2020-05-22 01:14:42 -04:00
rusefi 09ff35918b progress 2020-05-21 22:33:48 -04:00
kon 8d35c35035
Aux serial (#1422)
* aux serial updates from last PR

* trying to guess

* wow that's old! also not working maybe?

* hiding diag code which was messing with GP2/GP3 i.e. TLE8888_PIN_22 TLE8888_PIN_23

* date

* Mc33 undervolt (#1421)

* mc33 flash check

* DI sanity checks for setting HV config

* mc33 under voltage check

* mc33 under voltage check

Co-authored-by: Christopher W. Anderson <gitstuff@pswitch.com>

* fixed {}

Co-authored-by: rusefi <rusefillc@gmail.com>
Co-authored-by: NOx-z <50815960+NOx-z@users.noreply.github.com>
Co-authored-by: Christopher W. Anderson <gitstuff@pswitch.com>
Co-authored-by: kon <dev@triggerdevel>
2020-05-11 12:17:42 -04:00
dron0gus 474d5e64cf
Update chibios (#1364)
* Update ChibiOS

* Fix coexistance of ChibiOS and our flash drivers

* Add 'int' = internal prefix for all on-chip flash functions

This avoid conflict with ChibiOS functions available after
enabling HAL_USE_EFL

* Exclude ChibiOS flash driver from bootloader

* Makefile magic?

* Kinetis: fix build after ChibiOS update and switching to SMART_BUILD

* Bootloader now use SMART_BUILD too
2020-04-25 16:32:32 -04:00
rusefi 2f69beee31 a bit of header clean-up 2020-04-06 13:05:30 -04:00
Matthew Kennedy bb9c851a07
Deduplicate mpu_util headers (#1187)
* this flag did nothing

* header dedupe

* mre fix again

* get all dependencies in mpu_util.h

* guard can/spi

* more dedupe

* pragma once

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-03-13 18:48:22 -04:00
Matthew Kennedy fc051fd2ca
remove (#1188)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-03-13 17:19:29 -04:00
Matthew Kennedy ada5d5fee7
insert dsb on flash write (#1160) 2020-02-25 23:52:11 -05:00
Matthew Kennedy 52c710bb62
move flash addr in to mpu_util (#1123)
* move flash addr in to mpu_util

* this _may_ work

* don't use offsetof

* proper header + defines
2020-02-05 08:06:38 +05:30
Matthew Kennedy ff3329655a
Dont cache dma buffers (#1110)
* add no_cache

* don't disable cache

* conventions

* formatting
2020-01-29 00:32:43 -05:00
rusefi 1817b8654e SCB_DisableDCache rollback 2020-01-25 21:30:19 -05:00
rusefi fea2394c7b F7 SPI challenges 2020-01-24 23:52:56 -05:00
rusefi bb217b01dd happy new year unification 2020-01-13 21:57:43 -05:00
rusefi b83a5310be happy new year 2020-01-08 00:02:40 -05:00
dron0gus 1b42748e60 Spi fixes (#1083)
* spi: add support for SPI4

* mpu_util: spi: add 8BIT mode definitions for F4, F7 and kineris (?)
2020-01-06 08:44:23 -05:00
rusefi d575ffe5c1 enabling TIM8 ICU 2019-12-25 09:28:51 -05:00
Matthew Kennedy eb27bcf3d6 Terrible ADC3 hack for Proteus vbatt support (#1066)
* this is a great idea!

* typo

* simplify

* simplify, cache coherency

* enable adc3 in board file

* copyright

* fix tests, probably
2019-12-17 08:34:56 -05:00
rusefi af4f20551b getting rid of boardConfiguration / binary compatible change 2019-12-11 17:48:55 -05:00
andreika-git 97884dc677 Kinetis: fix ENABLE_PERF_TRACE and trigger_input_comp (#1031)
* Kinetis: fix ENABLE_PERF_TRACE

* Kinetis: fix trigger_input_comp
2019-11-25 00:22:26 -05:00
rusefi 4305b4ce2f not needed since included in common_headers.h 2019-11-23 18:16:41 -05:00
andreika-git e8fa6135f4 Kinetis: smarter SPI_CS control (#993) 2019-11-01 10:50:22 -04:00
andreika-git ee5ee1942c Kinetis & TLE8888 compatibility & fixes... (#991)
* TLE8888: More compatibility & postTunerStudioState

* activeConfiguration & EFI_ACTIVE_CONFIGURATION_IN_FLASH fix

* Kinetis: jump_to_bootloader() impl.

* Kinetis: UART baudrate safety check

* Kinetis: OMG!..
2019-10-31 16:06:34 -04:00