Lishui "Open Source Firmware" project / KingMeter 5S

That's OK. So you can check the signal between GND and the three phase wires first. There should be no signal, if the motor has been in standstill for several seconds. If you turn the throttle slightly, there should be a square wave with an amplitude of the battery voltage with a duty cycle of about 50% on all three phases.
The square wave disappears and is replaced by a constant battery voltage that lasts for a few seconds then most of the times drops down to about 9 volts (with no cogging) sometimes it goes down to about 0. I've had a few times where it seems like everything is fine (almost no voltage on phases) but the motor still cogs, which is "fixed" by applying a small throttle (just enough for the PWM to start) and then waiting for the remaining battery voltage to disappear.

May this have anything to do with the "dead resets" and no response to throttle input with a constant speed after the initial spin up?
 
and is replaced by a constant battery voltage that lasts for a few seconds
That's normal for a floating state, you would have to add a pull down or pull up resistor to pull the phase to a defined potential.
I don't know, what is happening in your system, but the voltage seems to rise very slow at startup, the phase current offset should be about 2048 (half of 12 bit ADC resolution)
In the log of @rwoculus it's fine.
phase current offsets: 2040, 2044, 2056

In your logs, it's far away. With this offsets, you'll get completely wrong phase current readings. This explains the strange behaviour of your system. 💡
Code:
phase current offsets:  994, 1015, 1013

How do you switch on your system?! :unsure:
 
Last edited:
How do you switch on your system?! :unsure:
As of now I use a jst sm 5 pin connector with the ground, RX,TX lines connected to the analyser and blue shorted to red. Then I just flip the battery switch.

I don't know, what is happening in your system
Thank you for your time, I'm unfortunately just as clueless. Hope that this series of messages will someday help someone else.
 
As of now I use a jst sm 5 pin connector with the ground, RX,TX lines connected to the analyser and blue shorted to red. Then I just flip the battery switch
Please change the order. Switch on the battery first, so the capacitors in the controller can get charged, then connect the red to the blue wire to power the processor. Check if the offsets are in the range of 2048 then...
 
when you run the javaconfigurator the config.h always has #define LEGALFLAG in it. This meens no higher speed then 6km's is actativated right? Then thats a bug in the configurator I guess.
 
This meens no higher speed then 6km's is actativated right?
Yes, throttle without pedaling is limited to 6kph then, with pedaling, the throttle works up to 25kph.
I haven't tried the Java Configurator after the last changes of @TENET. You can use an older commit, if you need to use the Java configurator.

 
Last edited:
Ok I have a scooter without pedals so now i used the no gui version and took the legalflag out. Have all parts in now will try tomorrow. How do i debug the display its an 800s where you can set ebik settings and read motor fualt codes. But it now show not connected even after selecting kentung. So want to see if i can find out what protocol it needs. And thank you very much for all your help.
 

This seems to use the Bafang protocol. So simply try the Bafang setting for display type.
The error codes, that EBiCS sends, are not the same as described in the display manual, but your should get no error anyway ;)

regards
stancecoke
 
Please change the order. Switch on the battery first, so the capacitors in the controller can get charged, then connect the red to the blue wire to power the processor. Check if the offsets are in the range of 2048 then...
No change. Current offsets are still way off, the throttle is still unresponsive and watchdog reset is still happening.
 

Attachments

  • out7.txt
    46 KB · Views: 2
Ok got the a clutch with the wrong direction so next plan is welding the clutch stuck so it no longer freeweheels. How do i disable regeneration completely? And i already tested befang but that didnt work.
 
Last edited:
You have to print out adcData[2], adcData[3] and adcData[4]. If these are about 2048 with closed throttle, you could try to set the offsets manually at startup.
Replaced the active printf with the commented line below (which prints out adcData[0] -> adcData[6]) and started the controller after letting the caps charge.

The raw values are almost identical even with applied throttle.
 

Attachments

  • out8.txt
    14.6 KB · Views: 1
My kick scooter is running great now :) the display keepts giving an cant communicate error. Is there someway to check what protocol it needs?
 
Hi,
I am back with my struggle after several weeks of travelling and being sick. :)
Just a reminder, I am getting E30 depending on system voltage, like described here.
I powered up the system at 48.6V, got E30, then I selected Run > Debug configurations > Debug in Eclipse and I see something like in attached picture. If I press F8 (resume) in eclipse, E30 disappears from the display and it looks like the controller is running - no signs of E30. I am not sure if I am correctly debugging since I can see status offline it bottom right corner, but there seems to be reaction from the controller when I press suspend button in Eclipse, I get E30 immediately and it disappears once I resume.

1743345016323.png
1743345061255.png

1743345189643.png
 
I am not sure if I am correctly debugging
Looks OK. The code is stopped at the breakpoint in line 209 (yellow mark left of the line number) at startup, then of course the E30 will appear, as the controller will send no reply when paused.
You can disable the breakpoints by the button of the debug menu bar in the top of the screen.
Have you adapted the interrupt priorities, like suggested?
 
This breakpoint at line 209 (at main), is this a result of Debug configurations > Startup?
When I unchecked it and power cycled the controller I could see again breakpoint at line 209 - I removed all breakpoints before power cycle. The problem is that when I connect, and see program is suspended, once I resume it seems to be working without any further problems resulting with E30 and I still do not know what caused E30 on startup.

I was indeed fiddeling with interrupt priorities like you indicated, but it brought no positive change in controller behavior. I also messed around in other parts of code as per chatgpt suggestion, so at certain point I again downloaded sensorless branch from your repo, because I was not sure if other changes were not affecting other things. Current state is that I have equal priorities at the moment. Can you suggent where I should lower priorities?

1743367795159.png
 
I added this fragment at the end of main.c
1743462807468.png
And something like this.
1743462895247.png

I also changed Debug settings not to set a break point at main and not to resume, I also changed reset mode to Connect under reset - my intention was to be able to connect to running system without resetting it. I am powering controller at 48.6V, I see E30 immediatelly and I connect from eclipse using debug and I can see that it looks stuck at line 1467, but why not inside while(1) loop? If I press resume at this point E30 disappears and If I pause at random times I can see program stops on various lines. Occasionally I can see missing source files messages like pasted below.

1743462554318.png

1743463289666.png
 
I am powering controller at 48.6V, I see E30 immediatelly and I connect from eclipse using debug and I can see that it looks stuck at line 1467,
OK, does this happen with the master branch also?
If not, this would be a strong hint to the interrupt priorities.

regards
stancecoke
 
Back
Top