Commit Graph

79 Commits

Author SHA1 Message Date
rusefillc ca0f3ba240 HW CI is flaky :( #2063
more detailed error messages
2020-12-17 20:22:04 -05:00
Andrey G 8e11675afd
Tle8888 big update 1 (#1892)
* smart gpio: fix tle8888 direct pin mapping for MRE

* MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888

* TLE8888: cleanup

* TLE8888: do not reset driver private data on WD/undervoltage reset

* TLE8888: diagnostic updates

* TLE8888 driver: BIG driver rework

* TLE8888: check SPI answers for abnormal states

Reply with other than requested register can be a sign of:
-Power-On-Reset, then OpStat0 will be replyed
-WatchDog reset, then FWDStat1 will be replyed
-Invalid communication frame, then Diag0 will be replyed

Keep tracking last accessed register and check with the next reply.

* TLE8888: debug clean-up

* TLE8888: implement spi array write

This reduce CS inactive state time between two consequent accesses
from 8.8 uS to 1.4 uS

* TLE8888: fix PP outputs in OD mode

* TLE8888: cleanup register definitions

* TLE8888: run separate driver thread for each chip instance

Calculating poll interval for few chips become more complex, avoid
this running thread for each device.

* TLE8888: fix cypress and kinetic compilation

Both platforms define its own MAX and cause redifination error if
common.h is included in driver.

* MRE: update mapping.yaml and fix direct pin mapping for TLE8888

* TLE8888: diagnnostic: disable switch off in case of overcurrent

For all output, use current limiting instead

* TLE8888: check for overvoltage on OUT8..OUT13

* TLE8888: add TODO note about how to recover from failure condition

Currently TLE8888 automaticly recovers only from overcurrent and
(may be) overtemperature conditions.
Short to bat cause output disable (bit in OECONFIG is reset) and
needs driver/host intervention.

* TLE8888: save few bytes of RAM

* TLE8888: Lada Kalina is test mule for IDLE stepper on TLE8888

Don't forget to enable PP mode for TLE8888 outputs 21..24:
uncomment line 1087 in tle8888.c

* TLE8888: reorder code, cleanup

* TLE8888: mode all debug/statisctic to per-chip struct

* TLE8888: rework poll interval calculation

* MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888 #2
2020-10-23 12:25:30 -04:00
rusefi e94631ad3d Merge remote-tracking branch 'origin/Hellen_fork_point' into master
# Conflicts:
#	firmware/hw_layer/digital_input/trigger/trigger_input.h
#	firmware/hw_layer/hw_layer.mk
#	firmware/hw_layer/ports/stm32/stm32f0/hw_ports.mk
#	firmware/hw_layer/ports/stm32/stm32f1/hw_ports.mk
#	firmware/hw_layer/ports/stm32/stm32f4/hw_ports.mk
#	firmware/hw_layer/ports/stm32/stm32f7/hw_ports.mk
2020-09-09 16:55:27 -04:00
rusefi 6fdb54d0dc Hellen says merge #1772 backup ram.h 2020-09-09 10:20:21 -04:00
rusefi 07e6e2c4ad steps towards tle8888 2020-05-06 19:20:12 -04:00
rusefi 96ceae7d17 refactoring: using constructor life-cycle to simplify initialization sequence 2020-05-02 23:15:48 -04:00
rusefi 4056cf1022 extracting method 2020-04-08 22:36:18 -04:00
Andrey Gusakov dae398d6cd pin_repository: fix for boards with gapes in brain_pin_e
Some additional math should be done to convert brain_pin_e to index
and back in case board do not have all chips exist in enum.

ifdef hell is for Kinetis board that uses its own brain_pin_e enum
2020-04-06 14:30:14 -04:00
Andrey Gusakov 30ccaa4c24 pin_repository: fix compilation for devices without TLE8888 2020-04-06 14:29:02 -04:00
rusefi 66570a0f28 smart gpio clean-up 2020-04-06 14:28:08 -04:00
rusefi 2f69beee31 a bit of header clean-up 2020-04-06 13:05:30 -04:00
Matthew Kennedy 0ca63356c0
improve pin error messages (#1252)
* improve error msg

* emulator pin names too

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-04-03 15:00:59 -04:00
Matthew Kennedy 61ee03ee06
Show fatal error text in TS (the right way) (#1232)
* enable TS error readout

* friendlier text for common errors

* improve comment
2020-03-29 07:27:36 -04:00
Matthew Kennedy c1319342d5
don't use standard sprintf/snprintf (#1174) 2020-03-07 10:28:18 -05:00
Matthew Kennedy 397907a06f
Support disabling most/all features (#1162)
* this flag did nothing

* guard features properly
2020-02-26 18:16:35 -05:00
rusefi 6c843e6954 tle8888 refactoring already - extracting method 2020-02-12 17:19:58 -05:00
rusEfi 01855b9c85 more commands 2020-02-12 08:53:50 -05:00
rusEfi 74ead04e84 tle8888 dump at init 2020-02-12 08:34:26 -05:00
rusEfi 4dbff5ff30 tle8888 output fix 2020-02-12 08:15:55 -05:00
rusefi 5665e43954 tle8888 output fix 2020-02-12 08:04:33 -05:00
dron0gus 82e33e45af
Tle8888 wd (#1143)
* tle8888: watchdog: debug over TS: remove tailing register address

* tle8888: ann console command to dump all regs
2020-02-11 17:49:14 -05:00
rusefi bb217b01dd happy new year unification 2020-01-13 21:57:43 -05:00
dron0gus 618d6f5a5e Gpio diagnostic (#1100)
* enums: add brain_pin_diag_e enum for pin diagnostic

* gpio core: add pin diagnostic call

* gpio: mc33810: add diagnostic support

* gpio: mc33972: add diagnostic support

* gpio: tle6240: add diagnostic

* pin_repository: output diagnostic data for gpio chips

* enums: kinetis: add brain_pin_diag_e enum for pin diagnostic
2020-01-12 10:20:10 -05:00
dron0gus 9f0d84f338 Gpio fixes (#1086)
* drivers: gpio: add MC33810 driver (skeleton)

* pin_repository: debug: do not show absent chips
2020-01-07 07:55:50 -05:00
rusefi a78dc22bf1 better state validation, better error codes 2019-11-29 23:41:26 -05:00
rusefi fd4412a2cd refactoring 2019-11-29 22:09:08 -05:00
rusefi ff3fbffd80 extracing constant & more information for HW CI 2019-11-29 21:57:59 -05:00
rusEfi d5ef749761 s/NULL/nullptr/ 2019-09-22 08:22:35 -04:00
rusefi c59d8164c6 unit tests progress 2019-09-19 21:41:52 -04:00
rusEfi 7800585cf6 minor fix: NONE pin UI representation 2019-07-14 22:47:11 -04:00
rusefi fecf83e4d2 order of includes consistency 2019-07-05 20:03:32 -04:00
rusefi 0295c343b9 Refactoring: OS access should be explicit #867 2019-07-04 03:25:35 -04:00
rusefi b81c60cf3e Refactoring: OS access should be explicit #867 2019-07-03 21:48:04 -04:00
andreika-git 970f67862c STM32-specific GPIO refactor (stm32_pins.cpp) (#817)
* stm32_pins.cpp

* PIN_USED & other
2019-06-02 16:48:38 -04:00
rusefi 1c36b89141 nicer pin names for messages while same short names for engine sniffer 2019-05-15 04:26:41 -04:00
dron0gus 04ee37548b Smart gpios fixes 3 (#795)
* pin_repository: provide readable pin names in error cases

* io_pins: remove getBrain_pin_eExt

We have getBrain_pin_eExt in io_pins.cpp and hwPortname in
pin_repository.cpp.
First uses auto-generated enums, second one uses runtime data to
provide name of hw pin.
Removing first saves us about 2K of flash couse big auto-generated
switch with pin names no more used by anyone and gets optimized out.

* gpios: mc33972: CS pin is now requested at smart_gpios.pcc

* getSpiDevice: support SPI4

* smart_gpios.cpp: startSmartCsPins set CSs to inactive state

OutputPin:initPin initializes pin with false value. This is active
state for SPI Chip Selects. Set to 1 to deselect all chips.
2019-05-09 18:09:24 -04:00
dron0gus 76cc822b1e Smart gpios (#752)
* efi_gpio: update cached pin value for ext gpios to

* tle6240: update and fix

* gpiochips_init should be called after all gpio chips are added

or we can lost calls to _init of chips

* smart_gpio.c: fix for tle6240 and mc33972

now config structs are not const. waste of ram...
2019-04-14 01:32:46 +02:00
rusefi 00e848c243 steps towards smarter gpio 2019-04-13 11:22:40 -04:00
rusefi 1e422f48f2 'pins' fix 2019-04-13 10:59:29 -04:00
dron0gus 1b39480e64 Gpiochips integration (#740)
* gpio-chips core function renames

* efi_gpio, pin_repository: add support for external gpios

* gpio-chips update

* gpio-chips: add api to name each pin of gpiochip

* tle6240: provide individual names for each pin
2019-04-10 14:43:54 +02:00
dron0gus c6a1d0cbe0 gpios rework (#739)
* Some more include fixes for linux

* Pass cross-compile path through CROSS_COMPILE

* Lower-upper case conversion fixes for linux

* Rename unmarkPin to brain_pin_markUnused

This is part of external gpiochip integration

* Add gpio_pin prefix to markUsed and markUnused

To distinguish from similar functions using brain_pin

* pin_repository: add helpers

this is part of gpio chips integration

* efi_gpio: simplify getHwPin using brain_pin_is_onchip
2019-04-10 01:31:10 +02:00
dron0gus be70420a71 Extgpios integration 1 (#734)
* pin repository: add brain_pin_markUsed and brain_pin_markUnused

This is part of external gpio chips integration

* pin repository: simplify getPinFunction()

* pin repository: add brain_pin_is_onchip()

This is part of external gpio chips integration

* pin repository: kill signed vs unsigned warning
2019-04-05 00:53:27 +02:00
andreika-git c34d7cac48 More compatibility for ADC_inputs, etc. (#716)
* Move STM32-specific ADC pinouts to ports/stm32/stm32_common.cpp

* Move STM32-specific files to ports/*

* setAdcChannelOverrides()

* Add #ifdefs for adc_inputs (PWM_FREQ_*, PWM_PERIOD_*, ADC_*_DEVICE)

* addChannel(), removeChannel()

* fix tle6240 compilation

* Add stm32_common.cpp to Makefile

* More ports/stm32/* paths

* More ports/stm32/* paths

* More flexible GPIO ports

* Add #ifdef for GPTDEVICE

* EFI_BOARD_TEST and EFI_JOYSTICK

* EFI_TLE8888

* Fix HIP9011_logic compilation

* ADC_CHANNEL_SENSOR

* Move ioportid_t PORTS[] to ports/*

* Fix simulator
2019-03-28 22:46:10 -04:00
dron0gus c9edbf4225 Cleanup fixes (#700)
* Kill some more warnings

* pin_repository: add markUnused, allow use from plain C

* ehiGpio.cpp: add forgotten GPIOG port
2019-03-08 07:01:15 -05:00
rusefi 9547c44ff1
688 brainpins (#694)
* GPIOF, GPIOG and GPIOH ports are not available #688
2019-02-22 22:10:41 -05:00
rusefi e6ac26bf2b better conditional compilation 2019-01-04 00:16:08 -05:00
andreika-git 23fea3c0c5 STM32 Nucleo144-F767ZI board: Initial support (#620)
* More EFI_ #ifdefs for config flexibility

* Even more config flexibility

* New firmware/config/stm32f7ems/* files

* New firmware/config/boards/NUCLEO_F767/* files

* New firmware/hw_layer/stm32f7/* files

* Fix for EFI_USB_SERIAL

* Adding #if defined(STM32F7XX)

* SPI flags changed in F7: SPI_CR1_DFF --> SPI_CR1_CRCL

* I2Cv2 config changed in F7

* More versatile CCM defines

* Makefiles

* Double #ifs cleanup

* docs
2018-11-16 07:40:06 -05:00
rusefi b74c579bcd #616 idle into simulator 2018-10-30 08:21:50 -04:00
rusefi 1f90cf153d refactoring 2018-09-16 22:26:57 -04:00
rusefi 99e74635ef step towards more unique codes 2018-07-25 23:30:00 -04:00