Commit Graph

187 Commits

Author SHA1 Message Date
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 3d17e62d65
finish off vbatt -> sensor model (#2433)
* more vbatt

* s

* goodbye voltage

* makefile

* apparently that part was in use

* include

* mocking
2021-03-07 20:18:32 -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 d933d18e29
use spiPolledExchange for small transfers (#2358)
* configure for no cache

* this doesn't need a setting

* now we don't need invalidate

* reorder and comment

* mmc

* sw knock

* use spiPolledExchange for small transfers

* mock spi

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-17 14:48:21 -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 7c231d968f H7 compilation #2284 2021-02-05 23:57:28 -05:00
rusefillc ac6c8a6c9f let's build for h7 2021-02-05 21:37:33 -05:00
Andrey G baea67eccf
Simplify Makefile, unify board.mk files (#2229)
* Proper way to add lis302 driver

* Proper way to add license directory to includes

* Makefile: simplify

All ChibiOS stuff is accumulated in ALLCSRC, ALLINC and so on.

* board.mk: append sources and includes to ALLSRC, ALLCPPSRC, ALLINC

* Cypress: fix CANv2 includence into build
2021-01-17 09:32:06 -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
Andrey G cd546cf932
TLE8888: temp fix of #2065 (#2079) 2020-12-14 15:33:27 -05:00
Matthew Kennedy 360a8c7524
add support for ext ids (#2060)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-12 16:34:21 -05:00
rusefillc 96c29840ce basic hw in the loop - pwm self validation #2028 2020-12-07 20:42:47 -05:00
Andrey G 7c6974ab43
Fixes after clenup (#2019)
* We still need consoleEventListener for boards with EFI_CONSOLE_SERIAL_DEVICE

* MC33810: add MC_ prefix for command defines

As CMD_PWM define is now used by console command
2020-12-05 11:54:09 -05:00
rusefillc 2f91ae6f73 Starter is engaged on start-up in pull-up configuration #1969 2020-11-26 10:55:39 -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
Andrey G f48621e4c2
TLE8888: disable diagnostic for OUTPUT8..13 (#1956)
Enabled pull-down affects analog inputs that shares same pins.
Disable it.
DOTO: enable diagnostic if ouput requested through tle8888_setPadMode
2020-11-17 18:33:37 -05:00
Andrey G 62f441376c
Tle8888 stepper (#1936)
* TLE8888: enable PP mode for OUT21..24 in case of useTLE8888_stepper

* Lada Kalina is a test mule for stepper idle
2020-11-10 14:16:46 -05:00
Andrey G 63c25ab8a7
Tle8888 small update (#1908)
* TLE8888: add support MR switching from SW

Main Relay has limitation - it is always active while KEY=1. When
KEY=0 MR can be switched on from SW.

* TLE8888: support reading of KEY and WAKE inputs

* Rusefi enums: add new TLE8888 pins
2020-11-01 22:19:55 -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 02573713f3 Hellen says drivers 2020-09-07 12:00:16 -04:00
rusefi 7d0c8b4870 microRusEFI used as Body Control Module BCM BCU
got stack too low warning with DBG_CAN
2020-09-06 21:45:17 -04:00
rusefi 1f6b820a96 microRusEFI used as Body Control Module BCM BCU 2020-09-06 21:30:14 -04:00
rusefi 39d09bc976 microRusEFI used as Body Control Module BCM BCU 2020-09-06 20:21:01 -04:00
rusefi e3b41c2387 dead code 2020-08-31 20:52:25 -04:00
rusefi 94daeb7922 OBD CAN sensors #1733 2020-08-29 14:36:23 -04:00
Matthew Kennedy 727f6e78ba explicit 2020-07-29 02:49:31 -07:00
kon 03f4efa0b2
BMW E90 Kombi (#1494)
* second can bus, first steps

* added most important messages; no more errors

* cleaned up can messages

* second can bus, first steps

* added most important messages; no more errors

* cleaned up can messages

* post rebase/merge fixes

* more rebase/merge fixes

* even more rebase/merge fixes

* more fixes, removed auto-gen files

* removed more auto-gen files...
2020-06-14 16:59:43 -04:00
rusefi a4329169e9 better file name 2020-05-25 13:02:05 -04:00
rusefi fc28692258 more readable error message thank you Matt! 2020-05-23 17:20:46 -04:00
rusefi 44b5e38d3a "TLE8888 SR Unexpected response" does not work as intended fix #1466 2020-05-22 22:56:19 -04:00
rusefi a0a1a9f9bb "TLE8888 SR Unexpected response" does not work as intended #1466 2020-05-22 08:23:49 -04:00
rusefi c95a4c552b more info into error message 2020-05-22 01:05:07 -04:00
dron0gus 7500e44c8c
tle6240: fix crash in driver wake routine (#1435) 2020-05-15 15:54:41 -04:00
rusefi 4e5a69891d new LED logic: constant WARNING if VBATT is below 7v 2020-05-13 01:52:27 -04:00
rusefi 257ed04fac new LED logic: constant WARNING if VBATT is below 7v 2020-05-13 01:17:48 -04:00
rusefi 52ad619b15 I think it's OK to crash very visibly if no proper SPI response 2020-05-13 01:07:11 -04:00
dron0gus e10259de99
either newline at end of mk file either no backslash on last line (#1425)
This fixes following build issue under linux:
make: *** No rule to make target 'build/obj/.cpp cj125.cpp', needed by 'build/obj/ build/obj/cj125.o'.  Stop.
make: *** Waiting for unfinished jobs....

Introduces in 8d35c35035
2020-05-12 09:55:43 -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
rusefi 75781f1262 hiding diag code which was messing with GP2/GP3 i.e. TLE8888_PIN_22 TLE8888_PIN_23 2020-05-11 00:53:50 -04:00
rusefi 633afc10c8 trying to guess 2020-05-09 20:45:20 -04:00
rusefi 19a1ad05b1 tle8888 restoration 2020-05-09 16:59:54 -04:00
rusefi b88b1e4aa5 mre 050 compromise 2020-05-09 09:40:00 -04:00
rusefi 8c3485a8dc Revert "Tle8888 for mre 050 (#1408)"
This reverts commit ba1a606d
2020-05-08 23:58:34 -04:00
dron0gus ba1a606d9a
Tle8888 for mre 050 (#1408)
* tle8888: fix tle8888_chip_init flow

* tle8888: set correct pin modes for mcu gpios in tle8888_chip_init

Direct drive, reset, inj_en and ign_en gpio should be outputs
2020-05-08 19:05:30 -04:00
dron0gus d0d5cdd4dd
tle8888: on MRE 0.5.0 we can drive ING_EN and INJ_EN from STM (#1407)
Do it!
2020-05-08 17:47:41 -04:00
dron0gus 98bca0cb23
Tle8888 stage 1 (#1404)
* TLE8888: implement diagnostic

* TLE8888: add support for PP mode on OUT21..24

* tle8888: use helpers to extract register value from 16bit reply
2020-05-07 09:49:57 -04:00
dron0gus 5987fb8b88
[SAFE] Debug cleanups (#1403)
* electronic throttle: inprove debug

* idle thread: show debug info for configured idle driver

* gpio-chips: make private functions static
2020-05-06 20:06:50 -04:00
rusefi 07e6e2c4ad steps towards tle8888 2020-05-06 19:20:12 -04:00
rusefi 0c5e41a36d fix master #1375 2020-04-28 08:10:36 -04:00