Skip to content

Commit

Permalink
v20.1C.3
Browse files Browse the repository at this point in the history
  • Loading branch information
emmebrusa committed Jun 3, 2021
1 parent 2424794 commit a80fcf7
Show file tree
Hide file tree
Showing 33 changed files with 3,359 additions and 1,027 deletions.
13 changes: 13 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
TSDZ2 Open Source Firmware v20.1C.3 for KT-LCD3 display

1 - Updated to v12 version of mspider65 (Hall sensor calibration missing)
2 - Updated to v13 version of mspider65 (but with 19KHz PWM frequency)
3 - Improved motor efficiency with high power (by mspider65)
4 - Improved the problem of delay in restarting with bike in motion (from mspider65 v12)
5 - Improved standing start response.
6 - Decreased eMTB torque offset, it was too sensitive at the start.
7 - Added "Motor deceleration" adjustable 0-100%, (100% = fast stop).
8 - Speed sensor error threshold time increased (E08).
9 - Added enable / disable "Field Weakening".


TSDZ2 Open Source Firmware v20.1C for KT-LCD3 display

Motor changes
Expand Down
Binary file added manuals/EN-LCD3_additional_manual-v20.1C.3.pdf
Binary file not shown.
Binary file removed manuals/EN-LCD3_additional_manual-v20.1C.pdf
Binary file not shown.
Binary file added manuals/IT-Manuale_integrativo_LCD3-v20.1C.3.pdf
Binary file not shown.
Binary file removed manuals/IT-Manuale_integrativo_LCD3-v20.1C.pdf
Binary file not shown.
Binary file modified manuals/odt/EN-LCD3_additional_manual-v20.1C.odt
Binary file not shown.
Binary file modified manuals/odt/IT-Manuale_integrativo_LCD3-v20.1C.odt
Binary file not shown.
990 changes: 990 additions & 0 deletions releases/v20.1C.3-LCD3/KT-LCD3-v20.1C.3-LCD3.hex

Large diffs are not rendered by default.

759 changes: 759 additions & 0 deletions releases/v20.1C.3-LCD3/TSDZ2-v20.1C.3-LCD3.hex

Large diffs are not rendered by default.

Binary file added releases/v20.1C.3-LCD3/v20.1C.3-LCD3.zip
Binary file not shown.
4 changes: 1 addition & 3 deletions src/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
#define HYBRID_ASSIST_MODE 5
#define CRUISE_MODE 6
#define WALK_ASSIST_MODE 7
//#define WALK_ASSIST_MODE 5
//#define CRUISE_MODE 6
//#define CADENCE_SENSOR_CALIBRATION_MODE 7
#define MOTOR_CALIBRATION_MODE 8

// error codes
#define NO_ERROR 0
Expand Down
4 changes: 2 additions & 2 deletions src/controller/Makefile_linux
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ ELF_SECTIONS_TO_REMOVE = -R DATA -R INITIALIZED -R SSEG -R .debug_line -R .debug
$(SDIR)/stm8s_tim1.c \
$(SDIR)/stm8s_tim2.c \
$(SDIR)/stm8s_tim3.c \
$(SDIR)/stm8s_tim4.c \
$(SDIR)/stm8s_exti.c \
$(SDIR)/stm8s_adc1.c \
$(SDIR)/stm8s_flash.c \
$(SDIR1)/common.c \
watchdog.c \
torque_sensor.c \
uart.c \
pwm.c \
Expand All @@ -56,7 +56,7 @@ ELF_SECTIONS_TO_REMOVE = -R DATA -R INITIALIZED -R SSEG -R .debug_line -R .debug
eeprom.c \
lights.c \

HEADERS = watchdog.h torque_sensor.h interrupts.h main.h uart.h pwm.h motor.h wheel_speed_sensor.h brake.h pas.h adc.h timers.h \
HEADERS = torque_sensor.h interrupts.h main.h uart.h pwm.h motor.h wheel_speed_sensor.h brake.h pas.h adc.h timers.h \
ebike_app.h pins.h eeprom.h lights.h config.h

# The list of .rel files can be derived from the list of their source files
Expand Down
4 changes: 2 additions & 2 deletions src/controller/Makefile_windows
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ ELF_SECTIONS_TO_REMOVE = -R DATA -R INITIALIZED -R SSEG -R .debug_line -R .debug
$(SDIR)/stm8s_tim1.c \
$(SDIR)/stm8s_tim2.c \
$(SDIR)/stm8s_tim3.c \
$(SDIR)/stm8s_tim4.c \
$(SDIR)/stm8s_exti.c \
$(SDIR)/stm8s_adc1.c \
$(SDIR)/stm8s_flash.c \
$(SDIR1)/common.c \
watchdog.c \
torque_sensor.c \
uart.c \
pwm.c \
Expand All @@ -55,7 +55,7 @@ ELF_SECTIONS_TO_REMOVE = -R DATA -R INITIALIZED -R SSEG -R .debug_line -R .debug
ebike_app.c \
lights.c \

HEADERS = watchdog.h torque_sensor.h interrupts.h main.h uart.h pwm.h motor.h wheel_speed_sensor.h brake.h pas.h adc.h timers.h \
HEADERS = torque_sensor.h interrupts.h main.h uart.h pwm.h motor.h wheel_speed_sensor.h brake.h pas.h adc.h timers.h \
ebike_app.h pins.h lights.h

# The list of .rel files can be derived from the list of their source files
Expand Down
20 changes: 7 additions & 13 deletions src/controller/adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,18 @@ void adc_init(void) {
GPIO_Init(GPIOB, (GPIO_PIN_7 | GPIO_PIN_6 | GPIO_PIN_5 | GPIO_PIN_4), GPIO_MODE_IN_FL_NO_IT);

ADC1_DeInit();
ADC1_ConversionConfig(ADC1_CONVERSIONMODE_SINGLE, ADC1_CHANNEL_7, ADC1_ALIGN_LEFT);
// Single conversion, Left alignement, Last channel = 7
ADC1_ConversionConfig(ADC1_CONVERSIONMODE_SINGLE, ADC1_CHANNEL_7, ADC1_ALIGN_RIGHT);
// ADC clock = CPU clock/3
ADC1_PrescalerConfig(ADC1_PRESSEL_FCPU_D3);
ADC1_ExternalTriggerConfig(ADC1_EXTTRIG_TIM, DISABLE);
ADC1_SchmittTriggerConfig(ADC1_SCHMITTTRIG_CHANNEL4, DISABLE);
ADC1_SchmittTriggerConfig(ADC1_SCHMITTTRIG_CHANNEL5, DISABLE);
ADC1_SchmittTriggerConfig(ADC1_SCHMITTTRIG_CHANNEL6, DISABLE);
ADC1_SchmittTriggerConfig(ADC1_SCHMITTTRIG_CHANNEL7, DISABLE);
// Enable Scan mode
ADC1_ScanModeCmd(ENABLE);
// Conversion is started by the TRGO event generated by the TIM1 counter
ADC1_ExternalTriggerConfig(ADC1_EXTTRIG_TIM, ENABLE);
// ENABLE ADC1
ADC1_Cmd(ENABLE);

// delay 3 sec (3000 ms) - perform some conversions
uint16_t ui16_counter;
for (uint8_t ui8 = 0; ui8 < 30; ui8++) {
// start ADC1 conversion
ADC1_ClearFlag(ADC1_FLAG_EOC);
ADC1_StartConversion();
ui16_counter = TIM3_GetCounter();
while ((TIM3_GetCounter() - ui16_counter) < 100)
;
}
}
13 changes: 7 additions & 6 deletions src/controller/adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
#include "main.h"

// for AIN6: 0x53E0 + 2*6 = 0x53E8
#define UI8_ADC_BATTERY_VOLTAGE (*(uint8_t*)(0x53EC)) // AIN6
#define UI8_ADC_THROTTLE (*(uint8_t*)(0x53EE)) // AIN7
//#define UI8_ADC_BATTERY_VOLTAGE (*(uint8_t*)(0x53EC)) // AIN6
//#define UI8_ADC_THROTTLE (*(uint8_t*)(0x53EE)) // AIN7
//#define UI8_ADC_BATTERY_CURRENT (*(uint8_t*)(0x53EA)) // AIN5
#define UI8_ADC_TORQUE_SENSOR (*(uint8_t*)(0x53E8)) // AIN4
//#define UI8_ADC_TORQUE_SENSOR (*(uint8_t*)(0x53E8)) // AIN4

#define UI16_ADC_10_BIT_BATTERY_VOLTAGE (((*(uint8_t*)(0x53EC)) << 2) | (*(uint8_t*)(0x53ED)))
// MSB LSB
//#define UI16_ADC_10_BIT_BATTERY_VOLTAGE (((*(uint8_t*)(0x53EC)) << 2) | (*(uint8_t*)(0x53ED)))
//#define UI16_ADC_10_BIT_BATTERY_CURRENT (((*(uint8_t*)(0x53EA)) << 2) | (*(uint8_t*)(0x53EB)))
#define UI16_ADC_10_BIT_THROTTLE (((*(uint8_t*)(0x53EE)) << 2) | (*(uint8_t*)(0x53EF)))
#define UI16_ADC_10_BIT_TORQUE_SENSOR (((*(uint8_t*)(0x53E8)) << 2) | (*(uint8_t*)(0x53E9)))
//#define UI16_ADC_10_BIT_THROTTLE (((*(uint8_t*)(0x53EE)) << 2) | (*(uint8_t*)(0x53EF)))
//#define UI16_ADC_10_BIT_TORQUE_SENSOR (((*(uint8_t*)(0x53E8)) << 2) | (*(uint8_t*)(0x53E9)))


void adc_init(void);
Expand Down

0 comments on commit a80fcf7

Please sign in to comment.