mutetus said:Anyone tried this firmware with a Tongsheng KZQW22A controller? The controller's ok, but I would prefer more options, starting with changing the ludicrously inconvenient assist level presets and making the controller protocol compatible with... well anything else but the unknown control panel it came with. The serial data is not standard, except for the start byte and adding everything together for a checksum, and consists pretty much only of how fast you want to go.
I'm also eager to modify the controller/firmware so that the brake light turns on when I brake and maybe also add turning signals, but instead of trying to manually decompile the entire firmware, this project seems to be just a tad ahead of my progress![]()
I've read and disassembled the firmware and after studying the code and hardware for a week it looks like I should make progress if I change the port mapping in the flexible opensource firmware code. Only things I'm not sure of are the current_phase_B, battery_over_current and total_current pins (starting with what the heck are they). Otherwise the hardware has pretty much all the same stuff as every other cheap controller + lot of furnished pins for custom stuff. The TSDZ2 firmware would be actually closer to this, but at least the PAS scheme is different.
Please post pictures!!!mutetus said:Yes, I'm aware of the other project as well, but like I said before the PAS sensor code doesn't match as this controller has only one PAS input. On the other hand that shouldn't require many changes to the TSDZ2 code and the rest of the code looks just too similar. My first guess is that there's also the torque sensor code in KZQW22A, but this one's missing some components for the sensor and on this model the brake is wired to one of the torque sensor pins, also known as external interrupt pin for timer 1. Besides that and the different hall sensor input pins, everything else looks like a too perfect match.
Didn't know you could go over the 16kB limit, gotta try that. Cheers.
mutetus said:Anyone tried this firmware with a Tongsheng KZQW22A controller? The controller's ok, but I would prefer more options, starting with changing the ludicrously inconvenient assist level presets and making the controller protocol compatible with...
I have a hunch this one cannot be altered much by changing the EEPROM values, the built-in programming connector tells me that this has some custom firmware tailored for the customer. My second clue was that the serial package from the led panel to the controller is only 5 bytes long and starts with $55, only the assist level value is saved and rest is discarded like old gloves.stancecoke said:A german seller offers to "reconfigure" the KZQW22A, so I guess you can change some parameters of the stock firmware by writing the EEPROM values in the way user hurzhurz explained for the stock firmware of the TSDZ2.
YES!! Do it, I mean put on recycle bin and buy a KT motor controller that is compatible with our OpenSource firmware. We took more than 1 year up to now to make this firmware and so you will profit from that!!mutetus said:Can't see much yet, I'm half way through freeing the board from the dessert.
Is that possible to define RX pin as input and with internal pull up so it does not float??stancecoke said:Some new important findings!
If Rx of the controller is floating, there is the danger of sudden reboots of the controller, especially if there's much electrosmog around (e.g. when motor running :wink: ). I think the controller is busy with UART interrupt handling in this case and the watchdog gets active.
Rx is floating, if the display communitcation doesn't work properly or if Rx isn't connected at all....
So make sure, that the display is working properly or connect Rx to GND if not connected!
I've updated the firmware at github to improve the speed signal reading with the external sensor. I found some spikes in the signal in a log while regenerating. The speed counter showed values about 1000 - 1250 (means speed greater than 100 km/h on an 28" wheel) for the spikes.
With this information it's obvious, that the approach of debouncing with a threshold of 1000 did't work for geofft. So I changed the threshold to 1500 (about 82 km/h @ 28").
stancecoke said:I've updated the firmware at github to improve the speed signal reading with the external sensor. I found some spikes in the signal in a log while regenerating. The speed counter showed values about 1000 - 1250 (means speed greater than 100 km/h on an 28" wheel) for the spikes.
With this information it's obvious, that the approach of debouncing with a threshold of 1000 did't work for geofft. So I changed the threshold to 1500 (about 82 km/h @ 28").
casainho said:Is that possible to define RX pin as input and with internal pull up so it does not float??
Yes, I think, that the spikes are of really short duration. With your code you are looking at the state of the line only every 64µs, so it would be fluke if you read exactly at that moment, the spike happens... With interrupt handling, you will catch any falling edge....casainho said:Maybe my code for reading the speed sensor works because it just look at the signal changes not less than 64us and that time interval can work as a low pass filter.
Great!!!! Thank you for testing! (Downhill freaks won't get speed information above 82 km/h nowgeofft said:Displayed speed now working perfectly - many thanks for your work on this..![]()
stancecoke said:Some new important findings!
If Rx of the controller is floating, there is the danger of sudden reboots of the controller, especially if there's much electrosmog around (e.g. when motor running :wink: ). I think the controller is busy with UART interrupt handling in this case and the watchdog gets active.
Rx is floating, if the display communitcation doesn't work properly or if Rx isn't connected at all....
So make sure, that the display is working properly or connect Rx to GND if not used!
I've updated the firmware at github to improve the speed signal reading with the external sensor. I found some spikes in the signal in a log while regenerating. The speed counter showed values about 1000 - 1250 (means speed greater than 100 km/h on an 28" wheel) for the spikes.
With this information it's obvious, that the approach of debouncing with a threshold of 1000 did't work for geofft. So I changed the threshold to 1500 (about 82 km/h @ 28").
regards
stancecoke
I think you need to pull the RX to VCC, not GND. (as uart is active low signalling)
stancecoke said:reset said:I'm wondering if it's possible to use 5s or 6s batteries and setting the controller at a voltage lower than the 24v.
With our firmware you can do this, as you can set the undervoltage limit yourself.
But be aware, the motor's high speed depends on the voltage. You will get much less high speed if you run a motor that is build for 36V with 20V only.
Perhaps you have to replace the resistor R62 to get the 5V supply properly....
![]()
regards
stancecoke
Maybe that button can have a more easy to understand name.stancecoke said:You have to press the "Write Option Bytes" Button of the Java Tool once with a brand new controller...
casainho said:Maybe that button can have a more easy to understand name.stancecoke said:You have to press the "Write Option Bytes" Button of the Java Tool once with a brand new controller...
On TSDZ2 firmware, just recently I implemented a check at firmware startup that verifies the Option Bytes and if not as needed the firmware programs what is needed - this case, to enbale PMW N channels, since I remember the same for KT. This way the user just need to erase/unlock and flash, no need anymore to flash the option bytes.
Stancecoke I suggest you to copy my code.
Ok, I remember now. Also KT-LDC3 has protected firmware. I think TSDZ2 is not protected because is a way for the OEMs to be able to make some customization/configuration by writing on EEPROM, just like we could do on our firmwares. I am working to make more and more options configurable on LCD3 and they are stored on EEPROM.nieles said:casainho said:Maybe that button can have a more easy to understand name.stancecoke said:You have to press the "Write Option Bytes" Button of the Java Tool once with a brand new controller...
On TSDZ2 firmware, just recently I implemented a check at firmware startup that verifies the Option Bytes and if not as needed the firmware programs what is needed - this case, to enbale PMW N channels, since I remember the same for KT. This way the user just need to erase/unlock and flash, no need anymore to flash the option bytes.
Stancecoke I suggest you to copy my code.
it isn't that easy for the KT controllers as they come with locked firmware. you need to do the write option bytes to erase the MCU.
casainho said:Maybe that button can have a more easy to understand name.
I can't blame others when I do the same as user, do something fast and see if works and if not, then I will use more time to read and understand why - if works at first, betterstancecoke said:casainho said:Maybe that button can have a more easy to understand name.
The name exactly describes what the button does
The write protection is just one bit of the option bytes. The write protection is disabled and the PWM settings are adjusted with the same click. I think it can't be easier for the user.
It would help a lot, if new users would read the tutorial![]()
...