Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Electric Motors and Controllers
famichiki   100 W

100 W
Posts: 130
Joined: Jul 12 2019 9:00am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by famichiki » Dec 26 2019 4:26am

Not sure how accurate the other readings of Mbrusa's firmware are, but the battery voltage certainly isn't right. I have a partially charged 52V battery and it's showing 59.2V but my bluetooth BMS shows the correct reading at 56.1V
Last edited by famichiki on Dec 26 2019 7:30am, edited 1 time in total.

User avatar
stancecoke   100 kW

100 kW
Posts: 1165
Joined: Aug 02 2017 2:56pm

Re: Tsdz2 firmware open source adapted to vlcd5

Post by stancecoke » Dec 26 2019 6:46am

godofglow wrote:
Dec 26 2019 1:11am
@stanecoke: do you update/merge your repo everytime if there is a new release from marco?
Hm, as far as I know, marcoq is inactive at the moment. The latest release that I know is the 0.19C that is already in my fork.
I would prefer that marcoq would take half an hour of time to get familiar with github, of course.

regards
stancecoke

Elinx   100 W

100 W
Posts: 186
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Elinx » Dec 26 2019 8:49am

stancecoke wrote:
Dec 26 2019 6:46am
...........
Hm, as far as I know, marcoq is inactive at the moment. .....
I think marcoq isn't complete inactive, because on Jobike he publish on regular base a teaser for a future version based on (again) v0.19 with ackmaniac and mbrusa mods. The latest v0.20 has problably a lot influence on the Java gui.
mbrusa has already proposed to help him with v0.20, because he already made some setup for it.
The problem is the Java gui, that is under control of marcoq.
If it remains unchanged (one page without tabs) then it is too small and choices have to be made wich settings comes in and wich will be removed.
But communication there is minimal too. So I think marcoq has a "lack of time" problem.
Last edited by Elinx on Dec 26 2019 4:56pm, edited 1 time in total.

mbrusa   1 W

1 W
Posts: 52
Joined: Dec 11 2019 12:13am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by mbrusa » Dec 26 2019 10:11am

famichiki wrote:
Dec 26 2019 4:26am
Not sure how accurate the other readings of Mbrusa's firmware are, but the battery voltage certainly isn't right. I have a partially charged 52V battery and it's showing 59.2V but my bluetooth BMS shows the correct reading at 56.1V
with Google Translate:
Hi famichiki, percentage and voltage to be precise must be calibrated.
A suitable editor (Notepad ++ example) is needed to edit two parameters in the ebike_app.h file
ACTUAL_BATTERY_VOLTAGE_PERCENT to correct the voltage value.
ACTUAL_BATTERY_CAPACITY_PERCENT to set the actual battery capacity.
The procedure is as follows:
Set the two values ​​to 100, compile and program.
With the battery fully charged, switch on the display.
Display the voltage.
With a nominal 36V battery it must be close to 42V, if it is lower try increasing ACTUAL_BATTERY_VOLTAGE_PERCENT until reading 42V, vice versa if it were higher it must be decreased. I had to put 101 (+ 1%)
Check the battery percentage, it must be at 99.9.
At this point, use the bike until the battery is completely exhausted.
Check the residual percentage and calculate the effective percentage value (100 - residual value). Set ACTUAL_BATTERY_CAPACITY_PERCENT with this value
Example I had the final residual 8%, effective percentage 92% (100 - 8), but with used battery the effective% could be much less.
It is important in the configurator to set “Li-ion Cell Voltage for 4/4 Bars” to at least 4.10 Volts, otherwise after a short turn, if the voltage does not fall below this value, when it is switched on again it resets to 99.9 again.
If the charge is not complete, the reset to 99.9 does not activate automatically. If desired, it can be done manually by activating the "set default" procedure within 5 seconds of power on (2 times the light button at level 0).

mbrusa   1 W

1 W
Posts: 52
Joined: Dec 11 2019 12:13am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by mbrusa » Dec 26 2019 10:58am

Important! The display speed must be set in km / h

Elinx   100 W

100 W
Posts: 186
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Elinx » Dec 26 2019 2:42pm

mbrusa wrote:
Dec 26 2019 10:58am
Important! The display speed must be set in km / h
That is for ALL measurement values, like torque too?
Otherwise can these measurements be recalculated if the setting was mph instead of kph?

famichiki   100 W

100 W
Posts: 130
Joined: Jul 12 2019 9:00am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by famichiki » Dec 26 2019 5:36pm

mbrusa wrote:
Dec 26 2019 10:11am
Hi famichiki, percentage and voltage to be precise must be calibrated.
Thanks for your reply.
Is that procedure only for the battery percentage display function?
Does the voltage display also need calibrating? Or is the raw voltage value always displayed?
Actually I have a more serious concern. I suspect my torque sensor is defective.
How can I compare my sensor with the data shown here?

Grazie per la tua risposta.
Questa procedura è solo per la funzione di visualizzazione della percentuale della batteria?
Anche la visualizzazione della tensione deve essere calibrata? Oppure viene sempre visualizzata la tensione non elaborata?
In realtà ho una preoccupazione più seria. Sospetto che il mio sensore di coppia sia difettoso.
Come posso confrontare il mio sensore con i dati mostrati qui?

https://github.com/OpenSource-EBike-fir ... que-sensor

Does your function output comparable data?
If the data is not comparable, could you provide a correct data table for your method to be used for calibration?

La tua funzione produce dati comparabili?
Se i dati non sono comparabili, potresti fornire una tabella di dati corretta per il tuo metodo da utilizzare per la calibrazione?

(ui16_adc_read_torque_sensor_10b() / 10)

This data is displayed.
Questi dati vengono visualizzati.

Code: Select all

0kg    18
10kg   23
20kg   27
80kg   32 (body weight)
Or should I use one of the other "test torque" options instead?
O dovrei usare invece una delle altre "test torque"?

ui8_torque_sensor * 10
ui8_torque_sensor_filtered * 10


I also tried it my way using this as v0.19 seems to do.
Ho anche provato a modo mio usando questo come v0.19 sembra fare.

ui16_pedal_torque_x10

This data is displayed.
Questi dati vengono visualizzati.

Code: Select all

0kg    14
10kg   35
20kg   90
Sono molto confuso!

mbrusa   1 W

1 W
Posts: 52
Joined: Dec 11 2019 12:13am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by mbrusa » Dec 27 2019 1:47am

Elinx wrote:
Dec 26 2019 2:42pm
mbrusa wrote:
Dec 26 2019 10:58am
Important! The display speed must be set in km / h
That is for ALL measurement values, like torque too?
Otherwise can these measurements be recalculated if the setting was mph instead of kph?
Yes for all values.
It works only with km/h set, with mph the values go out of range for the display, the same happens with km/h and wheel diameter less than 21 ".

mbrusa   1 W

1 W
Posts: 52
Joined: Dec 11 2019 12:13am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by mbrusa » Dec 27 2019 2:53am

famichiki wrote:
Dec 26 2019 5:36pm
mbrusa wrote:
Dec 26 2019 10:11am
Hi famichiki, percentage and voltage to be precise must be calibrated.
Thanks for your reply.
Is that procedure only for the battery percentage display function?
Does the voltage display also need calibrating? Or is the raw voltage value always displayed?
Actually I have a more serious concern. I suspect my torque sensor is defective.
How can I compare my sensor with the data shown here?

Grazie per la tua risposta.
Questa procedura è solo per la funzione di visualizzazione della percentuale della batteria?
Anche la visualizzazione della tensione deve essere calibrata? Oppure viene sempre visualizzata la tensione non elaborata?
In realtà ho una preoccupazione più seria. Sospetto che il mio sensore di coppia sia difettoso.
Come posso confrontare il mio sensore con i dati mostrati qui?

https://github.com/OpenSource-EBike-fir ... que-sensor

Does your function output comparable data?
If the data is not comparable, could you provide a correct data table for your method to be used for calibration?

La tua funzione produce dati comparabili?
Se i dati non sono comparabili, potresti fornire una tabella di dati corretta per il tuo metodo da utilizzare per la calibrazione?

(ui16_adc_read_torque_sensor_10b() / 10)

This data is displayed.
Questi dati vengono visualizzati.

Code: Select all

0kg    18
10kg   23
20kg   27
80kg   32 (body weight)
Or should I use one of the other "test torque" options instead?
O dovrei usare invece una delle altre "test torque"?

ui8_torque_sensor * 10
ui8_torque_sensor_filtered * 10


I also tried it my way using this as v0.19 seems to do.
Ho anche provato a modo mio usando questo come v0.19 sembra fare.

ui16_pedal_torque_x10

This data is displayed.
Questi dati vengono visualizzati.

Code: Select all

0kg    14
10kg   35
20kg   90
Sono molto confuso!
If the value is very different from the real one, it is better to also calibrate the voltage.
With (ui16_adc_read_torque_sensor_10b () / 10) to compare you have to make x 10 / 4.
With the latest version the values are directly comparable, I used UI8_ADC_TORQUE_SENSOR, the same as the 0.19 casainho version.
update

famichiki   100 W

100 W
Posts: 130
Joined: Jul 12 2019 9:00am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by famichiki » Dec 27 2019 3:56am

mbrusa wrote:
Dec 27 2019 2:53am
If the value is very different from the real one, it is better to also calibrate the voltage.
With (ui16_adc_read_torque_sensor_10b () / 10) to compare you have to make x 10 / 4.
With the latest version the values are directly comparable, I used UI8_ADC_TORQUE_SENSOR, the same as the 0.19 casainho version.
update
I installed your latest version today and traveled about 30 km.

The problem of the engine continuing to run a couple of seconds after stopping pedaling still exists. But forget it for now.

Furthermore, I found that the bike was very "fast" during my ride today. Minimal effort was required and it was difficult to drive slowly or maintain cadence with the engine.

I have tested my torque sensor many times and it is constantly low. So I hope I can correct it with calibration. I have a range of 18 - 35 which becomes more difficult at the top of the range above 30.

I wonder ... Would it be possible to calibrate via software? For example: we may have one configuration setting for our zero torque and another setting for the maximum torque. The maximum torque will depend on the user, it could be their body weight or maximum leg strength. Since the maximum torque of each person will be different, we can customize the torque sensor for the user. What are your thoughts?

...

Ho installato la tua ultima versione oggi e ho percorso circa 30 km.

Il problema del motore che continua a funzionare un paio di secondi dopo l'arresto della pedalata esiste ancora. Ma dimenticalo per ora.

Inoltre, ho scoperto che la bici era molto "veloce" durante la mia guida oggi. Era richiesto uno sforzo minimo ed era difficile guidare lentamente o mantenere la cadenza con il motore.

Ho testato il mio sensore di coppia molte volte ed è costantemente basso. Quindi spero di poterlo correggere con la calibrazione. Ho un intervallo di 18 - 35 che diventa più difficile nella parte superiore dell'intervallo superiore a 30.

Mi chiedo ... Sarebbe possibile calibrare via software? Ad esempio: potremmo avere un'impostazione di configurazione per la nostra coppia zero e un'altra impostazione per la coppia massima. La coppia massima dipenderà dall'utente, potrebbe essere il loro peso corporeo o la massima forza della gamba. Poiché la coppia massima di ogni persona sarà diversa, possiamo personalizzare il sensore di coppia per l'utente. Quali sono i tuoi pensieri?

Elinx   100 W

100 W
Posts: 186
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Elinx » Dec 27 2019 4:39am

famichiki wrote:
Dec 27 2019 3:56am
.......... Would it be possible to calibrate via software? For example: we may have one configuration setting for our zero torque and another setting for the maximum torque. The maximum torque will depend on the user, it could be their body weight ........
Problem is that the curve isn't complete lineair, above ~20kg, as you have seen here, where is a first description of the calibration proces. You must find the "knee" too. That is why calibration is adviced. If the first zero point is too high, the measurement with full weight is unreliable.
On the other end, there are already settings into the Java gui for setup the torque assistence. So maybe there are possibilities with minimal measurements.
torquesetting.jpg
torquesetting.jpg (12.43 KiB) Viewed 1094 times

famichiki   100 W

100 W
Posts: 130
Joined: Jul 12 2019 9:00am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by famichiki » Dec 27 2019 5:41am

I'm just been testing the torque level using the VLCD5's built in test mode. Is the value meant to change when pedal pressure is applied or is it only static? There is a TE mode which I thought was a live reading, because in the manual TE1 specifies it's the initial value only. Even if I apply pressure while entering the menu I still only see the initial value of 70.

This is Eco Cycles video showing a faulty motor.
https://www.youtube.com/watch?v=cOxYphMKx_Y

Interestingly there is a comment from someone there having some similar but more severe problems than me. Today while crossing a large divided road I had the green man, but when I reached the centre divider and stopped pedalling the motor continued to propel me across a few more lanes of traffic.
Mine is exhibiting sensor failure - it doesn't assist when I would expect it to, then occasionally pulses and, more awkwardly, decided to give full assistance at inopportune moments, like just when stopping at traffic lights.
vlcd5-testmode.png
vlcd5-testmode.png (39.78 KiB) Viewed 1086 times

Elinx   100 W

100 W
Posts: 186
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Elinx » Dec 27 2019 6:38am

famichiki wrote:
Dec 27 2019 5:41am
.....
This is Eco Cycles video showing a faulty motor.
.......
....when I reached the centre divider and stopped pedalling the motor continued to propel me across a few more lanes of traffic.
...
The question is. Is this behavior only with OSF or also with default FW.
If you have a bad torque sensor then you must have it too with default FW.
In the past there was for some people such a problem with OSF of marcoq, but that problem should be solved now.
A bad sensor can never be corrected.

For vlcd5 TE values
IMHO it must be possible to read weight values.
source
Last edited by Elinx on Dec 27 2019 11:47am, edited 1 time in total.

famichiki   100 W

100 W
Posts: 130
Joined: Jul 12 2019 9:00am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by famichiki » Dec 27 2019 7:05am

Elinx wrote:
Dec 27 2019 6:38am
The question is. Is this behavior only with OSF or also with default FW.
If you have a bad torque sensor then you must have it too with default FW.
The overrun was present in the factory firmware but the pulse/kicks of power were not. However I have not run the factory firmware long enough to see if the continual running occurs. That has only happened a few times in hundreds of km with OSF.

I just did the VLCD5 test again, the value does not change with either TE or TE1.. just a static 70. So that doesn't sound right going by the thread you linked to.

Elinx   100 W

100 W
Posts: 186
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Elinx » Dec 27 2019 7:31am

famichiki wrote:
Dec 27 2019 7:05am
...... So that doesn't sound right going by the thread you linked to.
I have XH18, so can't check. That is why I give this source. Maybe some other people can do.

famichiki   100 W

100 W
Posts: 130
Joined: Jul 12 2019 9:00am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by famichiki » Dec 27 2019 7:38am

I wonder if the value isn't changing because I've got the OSF installed. I'll revert to factory firmware tomorrow and try again. If there's still no change then there must be something seriously wrong.

User avatar
stancecoke   100 kW

100 kW
Posts: 1165
Joined: Aug 02 2017 2:56pm

Re: Tsdz2 firmware open source adapted to vlcd5

Post by stancecoke » Dec 27 2019 7:55am

Elinx wrote:
Dec 26 2019 8:49am
The problem is the Java gui, that is under control of marcoq.
I added the java source to my repo:
https://github.com/stancecoke/TSDZ2-Sma ... /OSEC.java

Eclipse for java can be used for editing and building the runnable .jar file.

regards
stancecoke

Elinx   100 W

100 W
Posts: 186
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Elinx » Dec 27 2019 8:11am

famichiki wrote:
Dec 27 2019 7:38am
I wonder if the value isn't changing because I've got the OSF installed.....
You could have a point there, otherwise mbrusa's mod for measuring values isn't necessary
Last edited by Elinx on Dec 28 2019 1:58pm, edited 1 time in total.

famichiki   100 W

100 W
Posts: 130
Joined: Jul 12 2019 9:00am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by famichiki » Dec 27 2019 7:53pm

Elinx wrote:
Dec 27 2019 8:11am
You could have a point there, otherwise mbrusa's mod for measuring values isn't necessary
I can confirm that the inbuilt VLCD5 torque measuring mode only works properly with the factory firmware installed, otherwise you will only receive an initial static reading for both TE and TE1.

To access the service viewing menu, hold both "i" + power for 8 seconds, then press "i" 4 times.

As mentioned on this other forum, the manual is incorrect and the TE1 mode will display the live changing value (with TE being the initial static value). This may help you diagnose a faulty torque sensor.

https://www.pedelecs.co.uk/forum/thread ... lem.33106/

However now I am getting a higher initial reading of 98 (was 70 with OSF) with a maximum reading of 190 when pressing with all my body weight and strength (80kg). I have no idea what this reading relates to though. :?:

According to Eco Cycle's video descriptions my initial reading is a little high (should be 80 +/- 10) but measuring it with OSF indicated it was low... well low according to Casainho's motor anyway. I don't know how many different motors he sampled to arrive at his recommended readings.

https://www.youtube.com/watch?v=cOxYphMKx_Y

Also I see in the main OSF thread that within a few hours of me wondering about software calibration Casainho has posted a method for doing just that. :thumb:

viewtopic.php?f=30&t=93818&start=4200#p1518241

So if anyone here is still running the factory firmware, or could revert and give this a try, I'd very very grateful to hear what torque values your VLCD5 displays.

ri53hu   100 mW

100 mW
Posts: 41
Joined: Apr 30 2018 3:56am
Location: Zlíňák

Re: Tsdz2 firmware open source adapted to vlcd5

Post by ri53hu » Dec 28 2019 8:47am

famichiki
I have these TE 1-0093 values without load
TE 1- 0217 pedal pressure
my weight 113 kg I use 19s (52v) firmware from Eco Cycle.
I'm using a translokator. R.

famichiki   100 W

100 W
Posts: 130
Joined: Jul 12 2019 9:00am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by famichiki » Dec 28 2019 9:00am

ri53hu wrote:
Dec 28 2019 8:47am
famichiki
I have these TE 1-0093 values without load
TE 1- 0217 pedal pressure
my weight 113 kg I use 19s (52v) firmware from Eco Cycle.
I'm using a translokator. R.
Thank you! :thumb:

chri27.5   10 mW

10 mW
Posts: 33
Joined: Jan 25 2019 9:46am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by chri27.5 » Dec 28 2019 3:40pm

stancecoke wrote:
Dec 27 2019 7:55am
Elinx wrote:
Dec 26 2019 8:49am
The problem is the Java gui, that is under control of marcoq.
I added the java source to my repo:
https://github.com/stancecoke/TSDZ2-Sma ... /OSEC.java

Eclipse for java can be used for editing and building the runnable .jar file.

regards
stancecoke

Good evening stance coke,
today marcoq has officially published on jobike that it will no longer release any version, its work ends like this. The cause of this decision was the publication of the decompiled sources of its configurator without consulting it, and without its permission.
Now we are left with no programmer to carry out this development.
I am very sorry for this, and I believe you should find a solution to this problem.
Thank you

thineight   100 W

100 W
Posts: 228
Joined: Oct 05 2018 3:53am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by thineight » Dec 28 2019 5:12pm

stancecoke wrote:
Dec 27 2019 7:55am
Elinx wrote:
Dec 26 2019 8:49am
The problem is the Java gui, that is under control of marcoq.
I added the java source to my repo:
https://github.com/stancecoke/TSDZ2-Sma ... /OSEC.java

Eclipse for java can be used for editing and building the runnable .jar file.

regards
stancecoke
Stancecoke, I understand marcoq did not agree to publish its source code for whatever reason, and that was clear to me since the beginning after the early discussion between him and casainho, plus the popup at the interface startup.

Any chance for you to remove the source code from your repo?

As already mentioned, marcoq's intention is to stop sharing the configurator updates with the community, and this is a substantial loss for all of us.
Hope you guys may clarify the matter for the benefit of the community.
Cheers.
MTB KTM Ultra 29" - City bike DAYTONA 28"

flufferty   100 mW

100 mW
Posts: 37
Joined: Apr 22 2017 4:00pm

Re: Tsdz2 firmware open source adapted to vlcd5

Post by flufferty » Dec 28 2019 5:20pm

thineight wrote:
Dec 28 2019 5:12pm

Stancecoke, I understand marcoq did not agree to publish its source code for whatever reason, and that was clear to me since the beginning after the early discussion between him and casainho, plus the popup at the interface startup.

Any chance for you to remove the source code from your repo?

As already mentioned, marcoq's intention is to stop sharing the configurator updates with the community, and this is a substantial loss for all of us.
Hope you guys may clarify the matter for the benefit of the community.
Cheers.
If you have used a GPL component in your software, then your entire software is considered a ‘work based on’ a GPL and, therefore:

You are not allowed to claim patents or copyright on the software. Moreover, you are obligated to display a copyright notice, disclaimer of warranty, intact GPL notices, and a copy of the GPL.
You are not allowed to change the license or introduce additional terms and conditions.
You are under the reciprocity obligation, which means you are obligated to release the source code and all of the rights to modify and distribute the entire code.

famichiki   100 W

100 W
Posts: 130
Joined: Jul 12 2019 9:00am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by famichiki » Dec 28 2019 5:41pm

It's not really necessary to use the configurator and any Marcoq based version can be programmed without it.

After clicking 'Compile' the configuration data is temporarily written to /src/controller/config.h and cleared again after compiling is finished.

So if you quickly copy that you will have an editable configuration file. Editing the file directly is not too bad, especially if you are already familiar with Marcoq's configurator.

Then you can just run Compile.bat and Program.bat in the root directory without needing to use the configurator.

When programming, if you get the below message it means you need to set your custom path to ST Visual Programmer (SVTP).

'STVP_CmdLine' is not recognized as an internal or external command, operable program or batch file

In /src/controller/configurator_program.bat you will see this:

Code: Select all

::PATH = %PATH%;C:\STMicroelectronics\st_toolset\stvp
PATH = %PATH%;%1
Change it to this:

Code: Select all

PATH = %PATH%;C:\enter\your\path\here
For example, this is mine (if you have spaces in your path name it's a good idea to put quotes around).

Code: Select all

PATH = %PATH%;"C:\Program Files (x86)\STMicroelectronics\st_toolset\stvp"
Alternatively if you want a one-step process, instead run /src/controller/compile_and_flash.bat the way you do with the original OSF. But again, if you have a custom path you'll need to edit this file.

Since Marcoq will no longer be updating the configurator, this way additional features can be added. Perhaps it's still a little daunting for new users but someone might decide to reformat the config.h file a bit nicer and add some explanations. Alternatively other configuration generators could be developed, such as a web-based version.

Here are the example configurations included with the configurator.

TSDZ2_Default_VLCD5_Configuration.ini

Code: Select all

/*
 * config.h
 *
 *  Automatically created by TSDZ2 Controller's Parameters Configurator
 *  Author: marcoq
 */

#ifndef CONFIG_H_
#define CONFIG_H_

//=================================================================================================
// ENABLES
//=================================================================================================
#define ENABLE_VLCD6 0
#define ENABLE_VLCD5 1
#define ENABLE_XH18 0
#define ENABLE_LIGHTS_FROM_OEM 1
#define ENABLE_BACKWARDS_RESISTANCE_OFF 1
#define ENABLE_STREET_MODE_ON_STARTUP 0
#define ENABLE_EMTB_MODE_ON_STARTUP 1
#define ENABLE_WALK_ASSIST_FROM_OEM 1
#define ENABLE_BRAKE_SENSOR 0
#define ENABLE_THROTTLE 0
#define ENABLE_WHEEL_PERIMETER_FROM_OEM	1
#define ENABLE_WHEEL_MAX_SPEED_FROM_OEM 1
#define CHECKBOX11 0
#define ENABLE_DISPLAY_WORKING_FLAG 1
#define ENABLE_DISPLAY_ALWAYS_ON 0
#define ENABLE_WALK_ASSIST_OFF_DELAY 0
#define ENABLE_STREET_POWER_LIMIT 1
#define TEMPERATURE_LIMIT_FEATURE_ENABLED 0
#define STARTUP_BOOST_WHEN_SPEED_IS_ZERO 1
#define STARTUP_BOOST_WHEN_CADENCE_IS_ZERO 0
//=================================================================================================
// BATTERY
//=================================================================================================
#define ADC_BATTERY_CURRENT_MAX_LIMIT 18.0
#define TARGET_MAX_BATTERY_POWER (uint16_t) 625
#define BATTERY_MAX_CURRENT_FLOAT 17.0
#define BATTERY_CELLS_NUMBER (uint8_t) 10
#define BATTERY_LOW_VOLTAGE_CUT_OFF_DIV10 29.0
#define BATTERY_PACK_RESISTANCE (uint16_t) 196
#define DIVISOR_FOR_CUTOFF_CALC (uint16_t) 44
#define LI_ION_CELL_OVERVOLT 4.25
#define LI_ION_CELL_VOLTS_100 3.90
#define LI_ION_CELL_VOLTS_75 3.70
#define LI_ION_CELL_VOLTS_50 3.44
#define LI_ION_CELL_VOLTS_25 3.20
#define LI_ION_CELL_EMPTY 3.00
#define ENABLE_VLCD5_BATTERY_SOC_4_BARS 0
#define SOC_BATTERY_VOLTAGE_FILTER_COEFFICIENT (uint8_t) 4
#define SOC_BATTERY_CURRENT_FILTER_COEFFICIENT (uint8_t) 4
#define SOC_ADC_BATTERY_VOLTAGE_PER_ADC_STEP 0.0866
#define READ_BATTERY_VOLTAGE_FILTER_COEFFICIENT	(uint8_t) 2
#define READ_BATTERY_CURRENT_FILTER_COEFFICIENT (uint8_t) 2
//=================================================================================================
// MOTOR
//=================================================================================================
#define MOTOR_TYPE_36V 1
#define MOTOR_TYPE_48V 0
#define EXPERIMENTAL_HIGH_CADENCE_MODE 0
#define MOTOR_ASSISTANCE_WITHOUT_PEDAL_ROTATION 0
#define MOTOR_PHASE_CURRENT_MAX_AMP 30.0
#define MOTOR_ROTOR_OFFSET_ANGLE (uint8_t) 10
#define MOTOR_ROTOR_ERPS_START_INTERPOLATION_60_DEGREES	(uint8_t) 10
#define MOTOR_OVER_SPEED_ERPS (uint16_t) 520
#define MOTOR_OVER_SPEED_ERPS_EXPERIMENTAL (uint16_t) 700
#define TXTFIELD25 0
#define TXTFIELD26 0
//=================================================================================================
// PWM DUTY CYCLE
//=================================================================================================
#define PWM_CYCLES_SECOND (uint16_t) 15625
#define PWM_DUTY_CYCLE_MIN (uint8_t) 20
#define PWM_DUTY_CYCLE_MAX (uint8_t) 254
#define PWM_DUTY_CYCLE_RAMP_UP_DIV1000 1.3
#define PWM_DUTY_CYCLE_RAMP_DOWN_DIV1000 1.3
#define CURRENT_RAMP 5.0
#define TXTFIELD34 0
//=================================================================================================
// WHEEL and PAS
//=================================================================================================
#define WHEEL_PERIMETER (uint16_t) 2083
#define WHEEL_MAX_SPEED (uint8_t) 45
#define OEM_WHEEL_SPEED_DIVISOR (uint16_t) 315
#define WHEEL_SPEED_SENSOR_MAX_PWM_CYCLE_TICKS (uint16_t) 1166
#define WHEEL_SPEED_SENSOR_MIN_PWM_CYCLE_TICKS (uint16_t) 65534
#define WHEEL_SPEED_PI_CONTROLLER_KP_DIVIDEND (uint8_t) 100
#define WHEEL_SPEED_PI_CONTROLLER_KP_DIVISOR (uint8_t) 4
#define WHEEL_SPEED_PI_CONTROLLER_KI_DIVIDEND (uint8_t) 40
#define WHEEL_SPEED_PI_CONTROLLER_KI_DIVISOR (uint8_t) 6
#define PAS_NUMBER_MAGNETS (uint8_t) 20
#define TXTFIELD45 0
//=================================================================================================
// SOFT START
//=================================================================================================
#define INITIAL_SOFT_START_ASSIST_VALUE_X10 (uint16_t) 20
#define SOFT_START_TIMEOUT (uint16_t) 20
#define K_SOFT_START_FACTOR 0.990
//=================================================================================================
// PEDAL ASSIST LEVELS
//=================================================================================================
#define MASTER_LEVEL_FACTOR 1.0
#define ASSIST_LEVEL_FACTOR_X10_1 (uint16_t) 50
#define ASSIST_LEVEL_FACTOR_X10_2 (uint16_t) 120
#define ASSIST_LEVEL_FACTOR_X10_3 (uint16_t) 210
#define ASSIST_LEVEL_FACTOR_X10_4 (uint16_t) 300
//=================================================================================================
// THROTTLE
//=================================================================================================
#define ADC_THROTTLE_THRESHOLD (uint8_t) 10
#define THROTTLE_FILTER_COEFFICIENT (uint8_t) 1
#define ADC_THROTTLE_MIN_VALUE (uint8_t) 47
#define ADC_THROTTLE_MAX_VALUE (uint8_t) 176
//=================================================================================================
// TORQUE SENSOR
//=================================================================================================
#define ADC_TORQUE_SENSOR_THRESHOLD (uint8_t) 6
#define PEDAL_TORQUE_SENSOR_UNIT 0.55
#define AVERAGE_TORQUE_FACTOR 0.637
//=================================================================================================
// WALK ASSIST
//=================================================================================================
#define WALK_ASSIST_PWM_LEVEL_0 (uint8_t) 10
#define WALK_ASSIST_PWM_LEVEL_1 (uint8_t) 13
#define WALK_ASSIST_PWM_LEVEL_2 (uint8_t) 16
#define WALK_ASSIST_PWM_LEVEL_3 (uint8_t) 19
#define WALK_ASSIST_PWM_LEVEL_4 (uint8_t) 22
#define WALK_ASSIST_PERCENTAGE_CURRENT (uint8_t) 20
#define WALK_ASSIST_MAX_RAMP_TIME_DIV10 1.0
#define WALK_ASSIST_OFF_DELAY_PWM_DIV10 (uint8_t) 20
#define WALK_ASSIST_OFF_DELAY_TIME_DIV10 2.0
//=================================================================================================
// STREET MODE
//=================================================================================================
#define STREET_SPEED_LIMIT (uint8_t) 25
#define STREET_POWER_LIMIT (uint16_t) 250
//=================================================================================================
// MOTOR POWER BOOST
//=================================================================================================
#define STARTUP_MOTOR_POWER_BOOST_LIMIT_MAX_POWER 1
#define STARTUP_MOTOR_BOOST_ASSIST_LEVEL_PERCENT_1 (uint8_t) 100
#define STARTUP_MOTOR_BOOST_ASSIST_LEVEL_PERCENT_2 (uint8_t) 72
#define STARTUP_MOTOR_BOOST_ASSIST_LEVEL_PERCENT_3 (uint8_t) 43
#define STARTUP_MOTOR_BOOST_ASSIST_LEVEL_PERCENT_4 (uint8_t) 15
#define STARTUP_MOTOR_POWER_BOOST_TIME_DIV10 2.0
#define STARTUP_MOTOR_POWER_BOOST_FADE_TIME_DIV10 3.5
//=================================================================================================
// eMTB MODE
//=================================================================================================
#define EMTB_MOTOR_PULL_FACTOR 0.30
#define EMTB_START_ASSIST_LEVEL_FACTOR_X10 (uint16_t) 50
//=================================================================================================
// MOTOR TEMPERATURE
//=================================================================================================
#define MOTOR_TEMPERATURE_MIN_VALUE_LIMIT (uint8_t) 75
#define MOTOR_TEMPERATURE_MAX_VALUE_LIMIT (uint8_t) 85
#define READ_MOTOR_TEMPERATURE_FILTER_COEFFICIENT (uint8_t) 4
//=================================================================================================
// MAGIC BYTE
//=================================================================================================
#define MAGIC_BYTE (uint8_t) 170
//=================================================================================================
// STVP DIRECTORY
//=================================================================================================
#define STVP_DIRECTORY C:/STMicroelectronics/st_toolset/stvp

#endif /* CONFIG_H_ */
TSDZ2_Default_VLCD6_Configuration.ini

Code: Select all

/*
 * config.h
 *
 *  Automatically created by TSDZ2 Controller's Parameters Configurator
 *  Author: marcoq
 */

#ifndef CONFIG_H_
#define CONFIG_H_

//=================================================================================================
// ENABLES
//=================================================================================================
#define ENABLE_VLCD6 1
#define ENABLE_VLCD5 0
#define ENABLE_XH18 0
#define ENABLE_LIGHTS_FROM_OEM 1
#define ENABLE_BACKWARDS_RESISTANCE_OFF 1
#define ENABLE_STREET_MODE_ON_STARTUP 0
#define ENABLE_EMTB_MODE_ON_STARTUP 1
#define ENABLE_WALK_ASSIST_FROM_OEM 1
#define ENABLE_BRAKE_SENSOR 0
#define ENABLE_THROTTLE 0
#define ENABLE_WHEEL_PERIMETER_FROM_OEM	1
#define ENABLE_WHEEL_MAX_SPEED_FROM_OEM 1
#define CHECKBOX11 0
#define ENABLE_DISPLAY_WORKING_FLAG 1
#define ENABLE_DISPLAY_ALWAYS_ON 0
#define ENABLE_WALK_ASSIST_OFF_DELAY 0
#define ENABLE_STREET_POWER_LIMIT 1
#define TEMPERATURE_LIMIT_FEATURE_ENABLED 0
#define STARTUP_BOOST_WHEN_SPEED_IS_ZERO 1
#define STARTUP_BOOST_WHEN_CADENCE_IS_ZERO 0
//=================================================================================================
// BATTERY
//=================================================================================================
#define ADC_BATTERY_CURRENT_MAX_LIMIT 18.0
#define TARGET_MAX_BATTERY_POWER (uint16_t) 625
#define BATTERY_MAX_CURRENT_FLOAT 17.0
#define BATTERY_CELLS_NUMBER (uint8_t) 10
#define BATTERY_LOW_VOLTAGE_CUT_OFF_DIV10 29.0
#define BATTERY_PACK_RESISTANCE (uint16_t) 196
#define DIVISOR_FOR_CUTOFF_CALC (uint16_t) 44
#define LI_ION_CELL_OVERVOLT 4.25
#define LI_ION_CELL_VOLTS_100 3.96
#define LI_ION_CELL_VOLTS_75 3.70
#define LI_ION_CELL_VOLTS_50 3.44
#define LI_ION_CELL_VOLTS_25 3.30
#define LI_ION_CELL_EMPTY 3.00
#define ENABLE_VLCD5_BATTERY_SOC_4_BARS 0
#define SOC_BATTERY_VOLTAGE_FILTER_COEFFICIENT (uint8_t) 4
#define SOC_BATTERY_CURRENT_FILTER_COEFFICIENT (uint8_t) 4
#define SOC_ADC_BATTERY_VOLTAGE_PER_ADC_STEP 0.0866
#define READ_BATTERY_VOLTAGE_FILTER_COEFFICIENT	(uint8_t) 2
#define READ_BATTERY_CURRENT_FILTER_COEFFICIENT (uint8_t) 2
//=================================================================================================
// MOTOR
//=================================================================================================
#define MOTOR_TYPE_36V 1
#define MOTOR_TYPE_48V 0
#define EXPERIMENTAL_HIGH_CADENCE_MODE 0
#define MOTOR_ASSISTANCE_WITHOUT_PEDAL_ROTATION 0
#define MOTOR_PHASE_CURRENT_MAX_AMP 30.0
#define MOTOR_ROTOR_OFFSET_ANGLE (uint8_t) 10
#define MOTOR_ROTOR_ERPS_START_INTERPOLATION_60_DEGREES	(uint8_t) 10
#define MOTOR_OVER_SPEED_ERPS (uint16_t) 520
#define MOTOR_OVER_SPEED_ERPS_EXPERIMENTAL (uint16_t) 700
#define TXTFIELD25 0
#define TXTFIELD26 0
//=================================================================================================
// PWM DUTY CYCLE
//=================================================================================================
#define PWM_CYCLES_SECOND (uint16_t) 15625
#define PWM_DUTY_CYCLE_MIN (uint8_t) 20
#define PWM_DUTY_CYCLE_MAX (uint8_t) 254
#define PWM_DUTY_CYCLE_RAMP_UP_DIV1000 1.3
#define PWM_DUTY_CYCLE_RAMP_DOWN_DIV1000 1.3
#define CURRENT_RAMP 5.0
#define TXTFIELD34 0
//=================================================================================================
// WHEEL and PAS
//=================================================================================================
#define WHEEL_PERIMETER (uint16_t) 2083
#define WHEEL_MAX_SPEED (uint8_t) 45
#define OEM_WHEEL_SPEED_DIVISOR (uint16_t) 315
#define WHEEL_SPEED_SENSOR_MAX_PWM_CYCLE_TICKS (uint16_t) 1166
#define WHEEL_SPEED_SENSOR_MIN_PWM_CYCLE_TICKS (uint16_t) 65534
#define WHEEL_SPEED_PI_CONTROLLER_KP_DIVIDEND (uint8_t) 100
#define WHEEL_SPEED_PI_CONTROLLER_KP_DIVISOR (uint8_t) 4
#define WHEEL_SPEED_PI_CONTROLLER_KI_DIVIDEND (uint8_t) 40
#define WHEEL_SPEED_PI_CONTROLLER_KI_DIVISOR (uint8_t) 6
#define PAS_NUMBER_MAGNETS (uint8_t) 20
#define TXTFIELD45 0
//=================================================================================================
// SOFT START
//=================================================================================================
#define INITIAL_SOFT_START_ASSIST_VALUE_X10 (uint16_t) 20
#define SOFT_START_TIMEOUT (uint16_t) 20
#define K_SOFT_START_FACTOR 0.990
//=================================================================================================
// PEDAL ASSIST LEVELS
//=================================================================================================
#define MASTER_LEVEL_FACTOR 1.0
#define ASSIST_LEVEL_FACTOR_X10_1 (uint16_t) 50
#define ASSIST_LEVEL_FACTOR_X10_2 (uint16_t) 120
#define ASSIST_LEVEL_FACTOR_X10_3 (uint16_t) 210
#define ASSIST_LEVEL_FACTOR_X10_4 (uint16_t) 300
//=================================================================================================
// THROTTLE
//=================================================================================================
#define ADC_THROTTLE_THRESHOLD (uint8_t) 10
#define THROTTLE_FILTER_COEFFICIENT (uint8_t) 1
#define ADC_THROTTLE_MIN_VALUE (uint8_t) 47
#define ADC_THROTTLE_MAX_VALUE (uint8_t) 176
//=================================================================================================
// TORQUE SENSOR
//=================================================================================================
#define ADC_TORQUE_SENSOR_THRESHOLD (uint8_t) 6
#define PEDAL_TORQUE_SENSOR_UNIT 0.55
#define AVERAGE_TORQUE_FACTOR 0.637
//=================================================================================================
// WALK ASSIST
//=================================================================================================
#define WALK_ASSIST_PWM_LEVEL_0 (uint8_t) 10
#define WALK_ASSIST_PWM_LEVEL_1 (uint8_t) 13
#define WALK_ASSIST_PWM_LEVEL_2 (uint8_t) 16
#define WALK_ASSIST_PWM_LEVEL_3 (uint8_t) 19
#define WALK_ASSIST_PWM_LEVEL_4 (uint8_t) 22
#define WALK_ASSIST_PERCENTAGE_CURRENT (uint8_t) 20
#define WALK_ASSIST_MAX_RAMP_TIME_DIV10 1.0
#define WALK_ASSIST_OFF_DELAY_PWM_DIV10 (uint8_t) 20
#define WALK_ASSIST_OFF_DELAY_TIME_DIV10 2.0
//=================================================================================================
// STREET MODE
//=================================================================================================
#define STREET_SPEED_LIMIT (uint8_t) 25
#define STREET_POWER_LIMIT (uint16_t) 250
//=================================================================================================
// MOTOR POWER BOOST
//=================================================================================================
#define STARTUP_MOTOR_POWER_BOOST_LIMIT_MAX_POWER 1
#define STARTUP_MOTOR_BOOST_ASSIST_LEVEL_PERCENT_1 (uint8_t) 100
#define STARTUP_MOTOR_BOOST_ASSIST_LEVEL_PERCENT_2 (uint8_t) 72
#define STARTUP_MOTOR_BOOST_ASSIST_LEVEL_PERCENT_3 (uint8_t) 43
#define STARTUP_MOTOR_BOOST_ASSIST_LEVEL_PERCENT_4 (uint8_t) 15
#define STARTUP_MOTOR_POWER_BOOST_TIME_DIV10 2.0
#define STARTUP_MOTOR_POWER_BOOST_FADE_TIME_DIV10 3.5
//=================================================================================================
// eMTB MODE
//=================================================================================================
#define EMTB_MOTOR_PULL_FACTOR 0.30
#define EMTB_START_ASSIST_LEVEL_FACTOR_X10 (uint16_t) 50
//=================================================================================================
// MOTOR TEMPERATURE
//=================================================================================================
#define MOTOR_TEMPERATURE_MIN_VALUE_LIMIT (uint8_t) 75
#define MOTOR_TEMPERATURE_MAX_VALUE_LIMIT (uint8_t) 85
#define READ_MOTOR_TEMPERATURE_FILTER_COEFFICIENT (uint8_t) 4
//=================================================================================================
// MAGIC BYTE
//=================================================================================================
#define MAGIC_BYTE (uint8_t) 170
//=================================================================================================
// STVP DIRECTORY
//=================================================================================================
#define STVP_DIRECTORY C:/STMicroelectronics/st_toolset/stvp

#endif /* CONFIG_H_ */
Last edited by famichiki on Dec 28 2019 6:17pm, edited 1 time in total.

Post Reply