RoboDurden / Hoverboard-Firmware-Hack-Gen2.x

with different defines_2-x.h for different board layouts :-) Compiles with Keil version 6
GNU General Public License v3.0
85 stars 28 forks source link

Gen2.1.8 (ex2.10) (I seem to have found a new board) #25

Open Tommyboi2001 opened 1 year ago

Tommyboi2001 commented 1 year ago

20230919_083325 20230919_083256

RoboDurden commented 11 months ago

okay i uploaded the old hall order. Test it with the phase cables again switched.

RoboDurden commented 11 months ago

20:55 here in Germany, i go to bed. Would be good if you install keil and change the pins yourself in defines_2-10.h And choose the master/slave/single and REMOTE_XY in config.h

F7 = compile F8 = flash to hoverboard.

RoboDurden commented 11 months ago

with three hall cables, there are 6 combinations to check. Good night and good luck.

pacraf commented 11 months ago

you did not uploaded, I think ? files are 30 minutes old.

pacraf commented 11 months ago

reagarding keil - this will finish bad for me, but will try... for this I also have to sleep and prepare for hard battle.

pacraf commented 11 months ago

@Tommyboi2001 - maybe you feel comfortable with programming... ? :)

RoboDurden commented 11 months ago

Sorry @pacraf , i forgot to move the bin from readyToFlash to BinariesToTest.

I now have introduced an Arduino style pinMode and digitalWrite:


// LED defines
#define LED_GREEN   PA12    // thanks to pacraf, transistors are on led module !
#define LED_ORANGE  PA15    // thanks to pacraf, transistors are on led module !
#define LED_RED     PB3 // thanks to pacraf, transistors are on led module !

//#define LED_GREEN GPIO_PIN_12     // thanks to pacraf, transistors are on led module !
//#define LED_GREEN_PORT GPIOA
//#define LED_ORANGE GPIO_PIN_15    // thanks to pacraf, transistors are on led module !
//#define LED_ORANGE_PORT GPIOA
//#define LED_RED GPIO_PIN_3        // thanks to pacraf, transistors are on led module !
//#define LED_RED_PORT GPIOB

Please confirm that the new binaries still make the three led blink nicely to the rotation of the motor. Then i can update the change to all pins and all layouts. Currently only the 2.10 compiles ! That is a bad state for other users !!

pacraf commented 11 months ago

Thanks Robo! today after work will check it and give feedback.

Tommyboi2001 commented 11 months ago

@Tommyboi2001 - maybe you feel comfortable with programming... ? :)

I think i'm at a similar level to you

pacraf commented 11 months ago

So the status is that: HoverBoardGigaDevice/BinariesToTest/hoverboard 2.10 single Dummy hall_a0-a1-b10.bin works with switched motor cable Yellow <> Green

pacraf commented 11 months ago

HoverBoardGigaDevice/BinariesToTest/hoverboard 2.10 single Dummy hall_b10-a1-a0.bin works good when board Blue go to motor Yellow board green to blue of motor board yellow to green motor

RoboDurden commented 11 months ago

the three led still blinking nicely ?

RoboDurden commented 11 months ago

So i have compiled and uploaded all 6 hall combinations :-/ One of them should work nicely with the three motor phase cable colors matching the mainboard colors.

pacraf commented 11 months ago

and the WINNER is.............. hoverboard 2.10 single Dummy hall_a1-a0-b10.bin

RoboDurden commented 11 months ago

three led still blinking nicely ?

RoboDurden commented 11 months ago

Now you can continue with uart_master+slave or with single_uartBus :-)

pacraf commented 11 months ago

SO it is done congrats! yes, leds are blinking OK. Motor does what lolin says... tested HoverBoardGigaDevice/BinariesToTest/hoverboard 2.10 single UartBus id0.bin Current factor is in my opinion ~8 times to much. I see that with hand breaking it is max ~1,5 A

iSpeed: 282 iSlave: 0 iOdom: 979 iSpeed: 0.69 iAmp: 12.89 iVolt: 25.09

I will take on slave now... it may take some time for me. will try today, but I have to make some test rig...

RoboDurden commented 11 months ago

Thanks, i wait for the current rescaling until i need to recompile anyway..

pacraf commented 11 months ago

It was faster than expected. master slave works. HoverBoardGigaDevice/BinariesToTest/hoverboard 2.10 slave.bin HoverBoardGigaDevice/BinariesToTest/hoverboard 2.10 master Uart.bin

you know there is always a trap somewhere, and here as well. In slave board programming pinout has changed pin position (DIO <>CLK ) ,, GND the same....

RoboDurden commented 11 months ago

Would be nice if you make a little photo with the two headers and the DIO/CLK/GND/3.3V pins :-)

You PB12 circuit still does not make sense to me: grafik

I guess there is a connection from the 1k resistor to one of the inputs of the nearby dual-opamp for the currentDC-adc.

pacraf commented 11 months ago

here it is. image regarding schematics reverse, for sure there are more interconnections. It is tricky to trace it all. I will look on that more if it is helpfull for something.

RoboDurden commented 11 months ago

As you seem to have gotten the current adc and overcurrent-digital correct, it is not really helpful anymore. I just would need to delete your images from the repo. I would rather update it with a correct image that shows how the current is measured.

Is there a tiny led on these boards ? Like a little red led that used to turn on when the board is powered. I guess that would be this define:

// Mosfet output
#define MOSFET_OUT TODO_PIN
pacraf commented 11 months ago

Yes, delete the misleading image. Next days I will sit to it and resolve it better. small led indeed are on board. Will trace them too.

RoboDurden commented 11 months ago

@pacraf could you please test the two NEW binaries: hoverboard 2.10 NEW master Uart.bin and hoverboard 2.10 NEW slave.bin

Took me quite some time to nearly completely rewrite the defines_2.10.h

Chances are good that the code works just like before. But some code lines have changed, so i am not 100% sure.

I go to bed now Unbenannt

pacraf commented 11 months ago

the firmware seems to work (motors rotating with lolin communication, leds reflecting halls) buzzer is silent however.

btw. small LED goes to pin 6 = PF1 OSC OUT

pacraf commented 11 months ago

Port with this "two line "panel leds goes from PF6. of course via transistor and 1k

RoboDurden commented 11 months ago

Good to hear that my code changes still make the motors spin and uart remote + masterSlave communication still works.

So PF6 should be the upperLed ? If have set the the upperLed and lowerLed to the two additional pins of that dupont female header:

define UPPER_LED PB4 // pacraf: additional outputs on black dupont female header

define LOWER_LED PB5 // pacraf: pulldown, additional outputs on black dupont female header

If i now set UPPER_LED to PF6 then i do not really know what to do with PB4 ;-)

What is this "two line panel leds" ? one stripe of blue leds like the front lights of a car ?

Yes, buzzer pin was faulty.

Will upload new binaries shortly. Good morning from Germany. Where do you came from ?

RoboDurden commented 11 months ago

Okay new binaries online. The buzzer should work again (for master and single). This new one color led panel should light up on startup and turn off when init is done. Then this little onboard led should blink. The four leds on the panel can be controlled from the ESP32 again. So the hall led blinking is turned off.

pacraf commented 11 months ago

Good morning from Poland ;) PF6 is driving transistor that is supplying this panel , I called it "two line led panel" image

dupont was originally used for small RCreciver image

will test bin files.

pacraf commented 11 months ago

so my test was with UART (master + slave) files. what is not working (and I havent looked on that for a few last tests - so don't really know when it broke) is readings of voltage and current. it reports all the time: 0,42 A and 21,6V

Speed: -201 iOdomL: -229        iOdomR: -391        iSpeedL: -0.71   iSpeedR: 0.74      iAmpL: 0.42  iAmpR: 0.42        iVolt: 21.60
iSpeed: -186    iOdomL: -215        iOdomR: -406        iSpeedL: -0.65   iSpeedR: 0.69      iAmpL: 0.42  iAmpR: 0.42        iVolt: 21.60
iSpeed: -168    iOdomL: -202        iOdomR: -419        iSpeedL: -0.60   iSpeedR: 0.64      iAmpL: 0.42  iAmpR: 0.42        iVolt: 21.60
iSpeed: -153    iOdomL: -191        iOdomR: -432        iSpeedL: -0.54   iSpeedR: 0.58      iAmpL: 0.42  iAmpR: 0.42        iVolt: 21.60

Led which shows battery status indicated green leds, after few seconds switches off, after some seconds turns again led back, but maybe it is the same issue with reporting voltage to console)

small leds are not ON

led two line panel during buzzer power on sound is switched ON , then off. then sometimes blinks ...

if you want short movie, let me know.

There is one thing more, and this is topic I observe for all my master-slave playing (2.0 board, this 2.10 too) when testspeed.ino drivers master-slave , then sometimes (let's say once per 10 left - right sequences) for a short moment it behaves like stall... hard to describe it, maybe a movie? but as I said, this is not specific to this board, I already reported this to you for 2.0 board.

What I have to look is current UARTBUS status... if it also has this jerk or it is only master slave... but this is another topic.

RoboDurden commented 11 months ago

I have uploaded new binaries. Now i have completed all pin definitions, also the 6 bldc mosfet outputs. Motor should still spin nicely.

Yes, voltage and current should now read again.

As i have disabled TEST_HALL2LED

//#define TEST_HALL2LED // led the 3-led panel blink according to the hall sensors

All 5 led (you only have 3 + 1) get controlled by arduino code:

uint8_t  wState = 1;   // 1=ledGreen, 2=ledOrange, 4=ledRed, 8=ledUp, 16=ledDown   , 32=Battery3Led, 64=Disable, 128=ShutOff

void loop()
{
  unsigned long iNow = millis();
...

  if (iNow > iTimeNextState)
  {
    iTimeNextState = iNow + 3000;
    wState = wState << 1;
    if (wState == 128) wState = 1;  // remove this line to test Shutoff = 128
  }

That might explain the strange behavior of the led panels.

little onboard led should now blink because of the code line in main.c:

digitalWrite(MOSFET_OUT, (steerCounter%20) < 10 ); // onboard led blinking :-)

I forgot the pinMode in setup.c

pinMode(MOSFET_OUT, GPIO_MODE_OUTPUT);

Sorry i can not focus on that strange choppy/stuttering motor behavior now as we finalize the pin definitions.

The Arduino send the 64=Disable command after he cycled throuh all the leds. I could not see any effect so the motor disable does not seem to work.

RoboDurden commented 11 months ago

Have upaded the defines_2-0.h Would be nice if you could test the 2.0 binaries in the https://github.com/RoboDurden/Hoverboard-Firmware-Hack-Gen2.x/tree/main/HoverBoardGigaDevice/BinariesToTest

pacraf commented 11 months ago

bin files from previous test do not spin motors (not this just above - with updated defines_2-0.h) iOdom values due to hand rotate. in arduino sketch nothing changed.

iSpeed: -162    iOdomL: -6      iOdomR: 2       iSpeedL: 0.00    iSpeedR: 0.00      iAmpL: 0.02  iAmpR: 0.02        iVolt: 31.16
iSpeed: -180    iOdomL: -6      iOdomR: 2       iSpeedL: 0.00    iSpeedR: 0.00      iAmpL: 0.04  iAmpR: 0.02        iVolt: 31.16
iSpeed: -195    iOdomL: -6      iOdomR: 2       iSpeedL: 0.00    iSpeedR: 0.00      iAmpL: 0.16  iAmpR: 0.00        iVolt: 31.16
iSpeed: -213    iOdomL: -6      iOdomR: 2       iSpeedL: 0.00    iSpeedR: 0.00      iAmpL: 0.38  iAmpR: 0.02        iVolt: 31.16
RoboDurden commented 11 months ago

??? So the latest/newest 2.10 binaries do no longer spin the motor ? Or did you already test the 2.0 binaries and they do not work on your 2.0 setup ?

pacraf commented 11 months ago

Oh shit i mixed it all up. wait.

pacraf commented 11 months ago

current test binaries for 2.10 do not spin motors for me below debug from lolin voltage fine , iOdom sees movement by hand motors

iSpeed: 165 iOdomL: 63      iOdomR: 2       iSpeedL: 0.00    iSpeedR: 0.00      iAmpL: 0.10  iAmpR: 0.00        iVolt: 31.15
iSpeed: 183 iOdomL: 63      iOdomR: 2       iSpeedL: 0.00    iSpeedR: 0.00      iAmpL: 0.34  iAmpR: 0.02        iVolt: 31.15
iSpeed: 198 iOdomL: 63      iOdomR: 2       iSpeedL: 0.00    iSpeedR: 0.00      iAmpL: 0.14  iAmpR: 0.02        iVolt: 31.15
iSpeed: 216 iOdomL: 63      iOdomR: 2       iSpeedL: 0.00    iSpeedR: 0.00      iAmpL: 0.04  iAmpR: 0.00        iVolt: 31.15
iSpeed: 231 iOdomL: 63      iOdomR: 2       iSpeedL: 0.00    iSpeedR: 0.00      iAmpL: 0.02  iAmpR: 0.02        iVolt: 31.15
iSpeed: 249 iOdomL: 63      iOdomR: 2       iSpeedL: 0.00    iSpeedR: 0.00      iAmpL: 0.06  iAmpR: 0.02        iVolt: 31.15
pacraf commented 11 months ago

master dummy + slave rotates OK if it helps

RoboDurden commented 11 months ago

This is confusing. So latest hoverboard 2.10 master Dummy.bin + hoverboard 2.10 slave.bin is making both motors spin nicely. But hoverboard 2.10 master Uart.bin not ? Then only the uart RX line on the master board is no longer working ?

pacraf commented 11 months ago

Yes, I am to fast to answer with unchecked info. all works. just tx cable from lolin was out of socket... please do not comment that.

RoboDurden commented 11 months ago

Why not comment ? Loose connections happen to me all the time because i am way to lazy to use propper rx tx cables but extend these 20cm dupont prototype cables up to 80cm :-(

RoboDurden commented 11 months ago

Is the little onboard led blinking by now ?

pacraf commented 11 months ago

;) embarassing anyway.

regarding small leds: on slave board its constantly ON on master board it is like always ON but 3 times per second for very short time OFF . and repeating just like that every second.

pacraf commented 11 months ago

these "two line led" panels also behave strange. slave is never ON , master is blinking sometimes (like maybe every 20 seconds it will be blinking for two seconds)

pacraf commented 11 months ago

if you want to have a look how it blinks https://youtube.com/shorts/eLuaLC6NWLQ?feature=share

RoboDurden commented 11 months ago

The arduino test code is cycling the first 7 bits of wState every 21 seconds. So the 2pinLed should be on for 3 seconds every 21 seconds.

I found some old code that overwrote my new wState method to turn on/off the leds. Maybe now the second led panel (and the onboardLed) are working as they shoud.

new binares online.

pacraf commented 11 months ago

binaries are still one hour old - did you forgot to upload?

RoboDurden commented 11 months ago

looks so, sorry. now have uploaded.

pacraf commented 11 months ago

;) led are working OK. small leds nicely blinking, two line panels also lighted brightly every arduino 20s cycle.

pacraf commented 11 months ago

regarding led panels with colors (Master has green/red cross , slave has connected orange/red/green ) I see that cross connected to master is never ON. cross I mean this one - I have it on master connected image

pacraf commented 11 months ago

Hmm if I change panels (master = 6led , slave = 4ledcross) then I see that on slave led are never on. on master green appears on cycle. so seems that maybe the green leds are on different pins on both panels.. right? will look on that.