Commit Graph

49 Commits

Author SHA1 Message Date
Josh Stewart 36d22b4832 Allow secondary serial interface to be set on a per board basis rather than MCU only
Fixes #1135
2023-11-21 16:47:24 +11:00
Josh Stewart 329a5278a7 Move CAN buffers into the relevant comms files rather than boards
This should resolve #1116
2023-11-03 15:22:11 +11:00
Josh Stewart 7cca27ee28 Fix incorrect check from last commit on stm32F11 2023-10-13 14:01:17 +11:00
Josh Stewart f9d0f0fce2 Add compile warnings for stm32 if arguments have not been configured in boards.txt 2023-10-13 12:21:58 +11:00
Vitor Moreno B. Sales f133b0f613
Moved STM32 definitions from globals to board file (#1117)
* Moved STM32 definitions from globals to board file

Moved definitions from globals.h

Removed old STM32 generic library as this is very old and unused for almost 5 years.

* Remove old stm32_generic build environment from platformio.ini

---------

Co-authored-by: Josh Stewart <josh@noisymime.org>
2023-10-11 12:24:46 +11:00
tx_haggis b03db96ad7
Save 600+ bytes RAM (step 4 of 9) - deduplicate scheduler ISR functions (#1063) 2023-10-07 08:25:26 +11:00
Josh Stewart 484e3916e3 Further cleanup work on secondary comms. Slight RAM free up. 2023-10-06 11:48:05 +11:00
Josh Stewart 16403b41bc Allow for float values in SD log where supported with FPU 2022-08-10 12:12:42 +10:00
Tjeerd 827f078e6b
Fix for idle PWM on STM32. Enable idle timer when idle pwm is enabled. Fixes #907
Co-authored-by: Tjeerd <tjeerdie@users.noreply.github.com>
2022-08-02 17:10:29 +10:00
Daniel Tobias 540b3a4fa2
Correct typos found by codespell (#880) 2022-06-27 10:39:14 +10:00
Tjeerd dc87795718
bug fix. A workaround for failing emulated on internal flash writes + a root cause fix (#876)
* workaround for failing flash writes

* Root cause fix for EEPROM emulation on STM32

* Oops, remove some debugging functions.

Co-authored-by: Tjeerd <tjeerdie@users.noreply.github.com>
2022-06-27 09:30:40 +10:00
Daniel Tobias 7020705dbe
fix typos in code documentation (#816)
* fix typos in code documentation

* minor reverts

* fix typos in ini

Co-authored-by: Josh Stewart <josh@noisymime.org>
2022-04-11 10:49:58 +10:00
Pasi Kemppainen fb0a52bf6f
SD-Card logging for STM32 [EXPERIMENTAL] (#782)
* First test

* Update comments.
2022-02-05 09:15:58 +11:00
Pasi Kemppainen 34116ad223
New CAN-bus library for STM32 (#725)
* Use new CAN-library

* Fix CAN3 pin number

* Fix building on other platforms
2021-12-23 13:46:13 +11:00
Tjeerd 0322d31ccc
Added function: Reset eeprom with key (#657)
* Add eeprom reset with key

* small improvements

* increased robustness against accidental erase of EEPROM.

Co-authored-by: Tjeerd <tjeerdie@users.noreply.github.com>
2021-12-22 14:53:36 +11:00
Pasi Kemppainen e213f2534e
PWM Fan addition (#637)
* Added PWM Fan functionality

PWM Fan output for Teensy and STM32

* Teensy3.5 timer fix for PWM Fan.

* Fix the conflicts with incorporate AFR

* Possibility to use PWM fan on mega too

Not tested at this stage!! Do not merge yet.

* Fix log entry size

* Remove duplicate stuff and use same way off toggling fan

* Fix typo errors

* Move fan pin definitions to globals.h

* Fix problems related to PWM fan.

* Revert previous change.

* Fix problems with idle things

* fix idle duty getting stuck at 100%

* Revert "fix idle duty getting stuck at 100%"

This reverts commit 7e9779483b.

* Revert "Fix problems with idle things"

This reverts commit 8bccb56d9a.

* Revert "Revert previous change."

This reverts commit fcb962864a.

* Remove mega support

* fixes

* more fixes

* moar fixes

* Should be working now

* Update speeduino.ini

* Lots of tweaking

* Update to work better with current FW

* Fix compiler warnings and include update things.

* Minor fixes

* Update logger.ino

* Fan duty working on mega too and fan output will be on/off

Co-authored-by: Pasi Kemppainen <pazi88@users.noreply.github.com>
2021-11-24 12:18:41 +11:00
Josh Stewart 2439883a69 Further SD compatibility work with new comms 2021-11-20 08:29:11 +11:00
tx_haggis 5e409445a4
Use table iterator for EEPROM read/write (#620)
* refactor: use a loop for writeAllConfig.

Future proofing: new pages will get automatically
written

* Call existing [read|store]EEPROMVersion functions

* Common function to compute CRC address

* Bulk write calibration tables

* Use EEPROM get/put instead of hand rolled code

* Typedef the EEPROM address

I.e. the EEPROM.read() parameter type

* Encapsulate eepromWritesPending

* Remove C++ namespaces

* Use table iterators for read/write

* Rename storage.ino to .cpp

This fixes a warning
2021-09-14 16:51:26 +10:00
Tjeerd 5a6c089d01
Fixed bug in EEPROM emulation for STM32F401 and STM32F411 (#645)
General cleanup eeprom emulation

Co-authored-by: Tjeerd <tjeerdie@users.noreply.github.com>
2021-08-30 22:11:03 +10:00
Vitor Moreno B. Sales 9022bffb0a
Fixes for Arduino_Core_STM32 V2.0 (#592)
Fixes and added FRAM to the code

Fixes for Teensy 4.1
2021-07-04 11:30:12 +10:00
tx_haggis 02cb7bebd6
Isolate table3D member access in comms.ino (#545)
* fix!: fix ODR violations

* refactor: move page specific code into a separate CPP file

* refactor: page getter/setter share mapping logic

Extract common page-to-entity mapping logic from
getPageValue() & setPageValue() - place in map_page_offset_to_entity()
and share.

* performance: optimize CRC calc

Calculate page CRC by iterating over entities & tables.

* CRC table calculation - use table iterator

* refactor: use iterators for sendPage()

Re-implement sendPage() using page & table iterators
Future proof & fast

* refactor: sendPageASCII()

Pull put shared code into functions.
Use table iterator

* refactor: use shared axis factor

This puts the axis factor usage in one place

* refactor: encapsulate page size & count

Added getPageCount() & getPageSize()

* Added static_assert for all pages.

* Remove C++ language elements

namesapces, scope resolution, enum struct

* Rename comms.ino to comms.cpp

Provides better encapsulation of non-global
data & functions.

INO files are all mashed together by some
custom process. So everything becomes global and
static functions/variables aren't really private to
 the translation unit. Thus breaking encapsulation :-(
2021-04-21 14:36:27 +10:00
Vitor Moreno B. Sales dd3847bfd3
STM32 fixes and tweaks (#553)
* STM32 fixes and tweaks

Removed generic STM32F103 options from PlatformIO
Added optional serial compilations on PlatforIO
Make sure all timers are stoped at boot
Small speed improve at SPIasEEPROM
Added timers usage table to board_stm32_official.h

* Added base board
2021-04-15 10:26:58 +10:00
Tjeerd 6179d4b5ae
Create better support for STM32F401 and STM32F411 blackpills (#548)
* Create support for STM32F401 and STM32F411 blackpills

* Small bug introduced now fixed.

Co-authored-by: Tjeerd <tjeerdie@users.noreply.github.com>
2021-03-23 08:33:03 +11:00
Josh Stewart ca6eef2b31 Initial layout work on RTC and SD 2021-01-22 16:16:30 +11:00
Tjeerd 5c5ecbbcea
Fix building stm32 f401 (#489)
* fix building for STM32F401CC and general macro cleanup

* Now building for all generic STM32F4x7 boards in arduino IDE is ok.

* buildflag cleanup

Co-authored-by: Tjeerd <tjeerdie@users.noreply.github.com>
2020-12-08 00:43:01 +11:00
Vitor Moreno B. Sales 0760fa65d0
STM32 jump to DFU bootloader (#485)
* STM32 jump to DFU

This enable jumping to hardware bootloader with software command.
Based on @iLeeeZi previous work.

Co-Authored-By: iLeeeZi <3372213+iLeeeZi@users.noreply.github.com>
Co-Authored-By: Pasi Kemppainen <48950874+pazi88@users.noreply.github.com>

* lowercase functions fixes

Co-authored-by: iLeeeZi <3372213+iLeeeZi@users.noreply.github.com>
Co-authored-by: Pasi Kemppainen <48950874+pazi88@users.noreply.github.com>
2020-12-03 09:24:15 +11:00
Tjeerd 8451aacf55
Add support for stm32F401internal flash as EEPROM emulation (#462)
* Add support STM32F401CC using internal flash as EEPROM

* update flash location of EEPROM

Co-authored-by: Tjeerd <tjeerdie@users.noreply.github.com>
2020-12-02 10:52:13 +11:00
Vitor Moreno B. Sales 00801ad82f
Added pinIsReserved macro (#479)
* Added pinIsReserved macro

Function used to don't initialize reserved pins such as USB on ARM boards, each pin must be defined on board.h file

* Update board_teensy35.h

Include Serial and CAN0 pins
2020-12-02 08:59:44 +11:00
Pasi Kemppainen 8d262bd8fc
STM32 CAN bus library addition (#482)
* CAN-bus library for STM32

This adds CAN-bus library for STM32. Mainly for STM32F4, but others can be added later.

* CAN2 and F446 support added for STM32 CAN library

Adds support for second can interface and F446 bit timings.

* Fix STM32 CAN pin selection and STM32F1 support

The previous way to select CAN pins wasn't actually working, so this fixes that problem and also the F1 support too.

* Fix building for Mega/Teensy

* Update cancomms.ino

* Update speeduino.ino

Co-authored-by: Pasi Kemppainen <pazi88@users.noreply.github.com>
Co-authored-by: Josh Stewart <josh@noisymime.org>
2020-12-02 08:29:10 +11:00
Tjeerd 6faab8e485
Update on eeprom emulation (#424)
* Fix building for FRAM with globals.h setting

On request of vitor boss. A lot has been changed around  to make the selection of EEPROM emulation  type from the globals.h (including FRAM selection)

* Add support for EEPROM emulation on internal flash of STM32F7

* Updates on SPI Flash EEPROM

* Fix building for BACKUPSRAM as EEPROM.

* Add put() and get() functions to the EEPROM emulation. This is needed for the latest terminstor and other calibrations routines

Co-authored-by: Tjeerd <tjeerdie@users.noreply.github.com>
2020-08-10 08:58:00 +10:00
Vitor Moreno B. Sales f04ea85db4
BlackPill update (#406)
* BlackPill fix

* Fix for disable timers

* Fix STM32GENERIC
2020-07-02 17:25:16 +10:00
Tjeerd 7c82095d44
STM32F407 32bit timer issue fix (new) (#374)
* Fixed 32 bit timers again

* Set the battery voltage to a default value when board starts. So before a sensible value is read this is 0. The dwell correction is creating the ignition spurious pulses direct after reset of the  board. (When "flying start" the engine)
2020-07-02 10:35:27 +10:00
Tjeerd 4d5d961486
fix building for ST arduino core 1.9 (#387) 2020-05-22 13:23:05 +10:00
Tjeerd 1530bb892e
EEPROM emulation on internal flash for STM32F407 (#372)
* Added new Flash EEPROM emulation

# Conflicts:
#	platformio.ini
#	speeduino/board_stm32_official.ino
#	speeduino/init.ino
#	speeduino/src/SPIAsEEPROM/SPIAsEEPROM.cpp
#	speeduino/src/SPIAsEEPROM/SPIAsEEPROM.h

* changes to storage to make SPI flash work again

* cleanup
2020-05-06 15:22:48 +10:00
Tjeerd fae9ab5a6b
Configurable CS pin flash chip (#345)
* fix building with spi flash as config storage

* Fixing build with spi flash as EEPROM. Changed some pin numbers to match the board i am designing and testing now.

* Now cs pin for spi eeprom is settable by flag in build enviroment.

* Correct overflow for 32bit timers

* fix pins PA0-PA5 on some f407 boards

* Enable access to SRAM Backup domain at boot

* Add missing callback functions

* Change timer resolutions. Corrects idle/aux timer frequencies

* 32 bit overflow only for STM32F4

* Update platformio.ini

debug tool added as default

* fix building with spi flash as config storage

* Fixing build with spi flash as EEPROM. Changed some pin numbers to match the board i am designing and testing now.

* Now cs pin for spi eeprom is settable by flag in build enviroment.

* Update platformio.ini

debug tool added as default

* Update cancomms.ino

Removed CAN build on black_F407VE for now. It needs fixing the build fails otherwise.

Co-authored-by: hoogendijkta <tjeerdie@users.noreply.github.com>
Co-authored-by: iLeeeZi <ilari.vehniainen@hotmail.fi>
2020-04-18 08:04:03 +10:00
iLeeeZi 51cf91287f
STM32F407 fixes (#338)
* Correct overflow for 32bit timers

* fix pins PA0-PA5 on some f407 boards

* Enable access to SRAM Backup domain at boot

* Add missing callback functions

* Change timer resolutions. Corrects idle/aux timer frequencies

* 32 bit overflow only for STM32F4
2020-04-07 14:49:25 +10:00
Vitor Moreno B. Sales 433de94f81
Try to fix #311 (#324)
* Some Fixes to work

* Fix BluePill

* Remove libmaple defs

* STM32 Timers rework

* GCC9 Fix

* BlackPill update

* Disable FRAM as default for STM32

* STM32 storage options for all cores

* STM32 fixes 2

* Update FRAM lib

* Fix previos ADC 'fixed definitions'

* Fix duplicated pins

* Typo

* Fix compilation error for BluePill

* Fix timers Prescale
2020-02-18 17:30:44 +11:00
Vitor Moreno B. Sales 2c739a6582
BlackPill fixes (#317)
* Some Fixes to work

* Fix BluePill

* Remove libmaple defs

* STM32 Timers rework

* GCC9 Fix

* BlackPill update

* Disable FRAM as default for STM32

* STM32 storage options for all cores

* STM32 fixes 2

* Update FRAM lib
2020-02-03 13:53:40 +11:00
Vitor Moreno B. Sales e7dbbb2a75 Early 2020 STM32 fixes (#308)
* Some Fixes to work

* Fix BluePill

* Remove libmaple defs

* STM32 Timers rework

* GCC9 Fix

* BlackPill update

* Disable FRAM as default for STM32

* STM32 storage options for all cores
2020-01-24 12:32:51 +11:00
Josh Stewart 106b75509d Generic SPI as EEPROM changes. 2020-01-13 12:14:00 +10:00
hoogendijkta 3a42674d57 Repair code with new STM32duino 1.7.0 core 2019-09-30 21:29:26 +02:00
hoogendijkta a44cacc9d4 fix STM32F407 comilation wuth new stm32duino 1.7.0 2019-09-30 21:13:09 +02:00
hoogendijkta 30acafe300 Add SPI Flash storage as EEPROM onboard the Black STM32F407VET6 from ebay. 2019-09-21 22:52:01 +02:00
Bruno Bousquet 9fec203c5b remove _SLOW versions of MAX_TIMER_PERIOD and uS_TO_TIMER_COMPARE 2019-08-22 20:18:07 -04:00
Josh Stewart 4357b1b4cf Clean compile on Teensy 4 2019-08-21 15:15:19 +10:00
Josh Stewart 7ed645b574 stm32 SPIAsEEPROM compatibility work 2019-03-12 21:49:09 +11:00
Josh Stewart 430032d3ab Bring in stm32f407 official core support within platformio 2019-03-07 22:47:22 +11:00
Josh Stewart 942e4491c0 Add board variable to set where the EEPROM class will come from 2019-03-05 01:02:02 +11:00
Josh Stewart f96999dd2d Multiple stm32 and general arch cleanup/fix from last merge 2019-03-04 23:45:33 +11:00