electric_vehicle_lover Posted November 26, 2015 Share Posted November 26, 2015 @jayjay23 the osciloscope is cheap chinese like the power supply, the Jtag Stlink v2, the hot air station, the dev board, etc -- like the generic electric unicycle ;-) :-) I believe you can buy it now in Ebay for about 250€. @Restless do you have any news of the boards? Thanks. Quote Link to comment Share on other sites More sharing options...
Restless Posted November 26, 2015 Share Posted November 26, 2015 1 minute ago, electric_vehicle_lover said: @jayjay23 the osciloscope is cheap chinese like the power supply, the Jtag Stlink v2, the hot air station, the dev board, etc -- like the generic electric unicycle ;-) :-) I believe you can buy it now in Ebay for about 250€. @Restless do you have any news of the boards? Thanks. Do you have a Modell number for the power supply? Sry no news for the board. Last status i got is that they are shipped. Ali offers buyers protection so if we dont Get the boards we'll Get the money back ill keep you guys updated as soon as i have more Informations. Sry about that :/ Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted November 26, 2015 Share Posted November 26, 2015 My power supply, you can find reviews on youtube and buy on ebay: ps-605d danzeng power supply Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted November 27, 2015 Share Posted November 27, 2015 Today I did about 5kms with my generic. I can easily go up to max speed and the pedals start to tilt before the buzzer. I don't like the pedal tilt. The battery went down quickly, I saw the LEDs goind down over the 5kms. I was riding slow when the unicycle did beep, sent me backward and finally shuttedoff the wheel. It seems a safe procedure -- an idea to implement on this firmware. @jayjay23 my osci saves screenshots to a usb pen flash. Quote Link to comment Share on other sites More sharing options...
jayjay23 Posted November 27, 2015 Author Share Posted November 27, 2015 16 hours ago, Restless said: Do you have a Modell number for the power supply? Thought not the chepaest price I choose this one: http://www.amazon.de/gp/product/B00DVID50U?psc=1&redirect=true&ref_=oh_aui_detailpage_o03_s00 and two pairs of those: http://www.amazon.de/gp/product/B007R30ZT4?psc=1&redirect=true&ref_=oh_aui_detailpage_o03_s00 One is now soldered with a XT60 connector (thought they are quite tight and thus difficult to plug and especially unplug). Quote Link to comment Share on other sites More sharing options...
Restless Posted November 28, 2015 Share Posted November 28, 2015 Hey guys Today i recived the boards! Actually they look pretty good. Its an STM32 F103C8T6 onboard. So now there is just one problem .... i cant see an JTAG neither SWD label somewhere the JN4 looks like it could probably be a connection, since i could trace 2 of the pins directly to the ARM. Anyways, i'm sure well get along with these boards. Kai Quote Link to comment Share on other sites More sharing options...
OliverH Posted November 28, 2015 Share Posted November 28, 2015 (edited) We'll see. There's always a possibility to connect. The ARM has the Pins we look for. Either we follow the routing on the PCB or we solder directly. Was your calculation/ estimation on shipping costs right or do you need some more money? Edited November 28, 2015 by OliverH Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted November 28, 2015 Share Posted November 28, 2015 Great!! I can identify all the components, they are on the same position as on my board but mine have SWD pins on another place. That 4 pins are for sure the SWD. That board seems to be the "Generic A type" - see here pictures: https://github.com/generic-electric-unicycle/documentation/blob/master/images/controller/generic_a/img_1009861.jpg So happy that I may have my boards next week :-) -- thanks!! Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted November 29, 2015 Share Posted November 29, 2015 (edited) I just wrote a new idea/suggestion based on my experiencie/needs: Trolley mode: https://github.com/generic-electric-unicycle/firmware/issues/3 Edited November 29, 2015 by electric_vehicle_lover Quote Link to comment Share on other sites More sharing options...
jayjay23 Posted November 29, 2015 Author Share Posted November 29, 2015 (edited) My guess is as follows, from the backside you can definitely see, GND and Vref and two going under the chip: Just need to find out which is clock and which is IO (measuring from connector to proper STM pins should give the answer), for me this means building an adapter, as it's different from my current board connector. Edited November 29, 2015 by jayjay23 Quote Link to comment Share on other sites More sharing options...
jayjay23 Posted November 29, 2015 Author Share Posted November 29, 2015 Do I see it right that the plugs are soldered? As they don't seem to have the male plastic part around it. I've seen at least one wheel were the plugs were indeed directly soldered onto a board :-) Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted November 29, 2015 Share Posted November 29, 2015 @Restless, is possible for you to measure/follow the pins from the STM32F103 to the SWD conector so we can prepared any needed adapater? - thanks. 3 minutes ago, jayjay23 said: Do I see it right that the plugs are soldered? As they don't seem to have the male plastic part around it. I've seen at least one wheel were the plugs were indeed directly soldered onto a board :-) Seems to me that the board have conectors but they also sent some kind of extension cable with different connectors in the end. So now we have a code to turn on or off the LEDs for battery charge indication. What do you guys think should be next code/step?? Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted November 29, 2015 Share Posted November 29, 2015 I verified that my controller have the same connectors as the connectors on new boards. In fact, the same connector for the hall sensors are used on electric bicycles. The same for the connectors to motor phases. On my board, the SWD pins labels are: GND, SWD, CLK, 3V3. I hope is the same for the new boards. Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted November 29, 2015 Share Posted November 29, 2015 I soldered the pins of SWD to my unicycle board and tried to read the firmware (starting at flash address and ending at 64k) using OpenOCD but I got a lot of undefined instructions so I guess the code is protected - example: 104: f000d101 ; <UNDEFINED> instruction: 0xf000d101 108: f2aff851 vrshrn.i64 d15, <illegal reg q0.5>, #17 10c: e8ba0e09 ldm sl!, {r0, r3, r9, sl, fp} 110: f013000f ; <UNDEFINED> instruction: 0xf013000f 114: bf180f01 svclt 0x00180f01 118: f0431afb ; <UNDEFINED> instruction: 0xf0431afb 11c: 47180301 ldrmi r0, [r8, -r1, lsl #6] 120: 00006640 andeq r6, r0, r0, asr #12 124: 00006660 andeq r6, r0, r0, ror #12 128: f04f440a ; <UNDEFINED> instruction: 0xf04f440a 12c: f8100c00 ; <UNDEFINED> instruction: 0xf8100c00 130: f0133b01 ; <UNDEFINED> instruction: 0xf0133b01 134: bf080407 svclt 0x00080407 138: 4b01f810 blmi 0x7e180 13c: bf08111d svclt 0x0008111d 140: 5b01f810 blpl 0x7e188 144: d0051e64 andle r1, r5, r4, ror #28 148: 6b01f810 blvs 0x7e190 14c: f8011e64 ; <UNDEFINED> instruction: 0xf8011e64 150: d1f96b01 mvnsle r6, r1, lsl #22 154: 0f08f013 svceq 0x0008f013 158: f810bf1e ; <UNDEFINED> instruction: 0xf810bf1e 15c: 1cad4b01 fstmiaxne sp!, {d4-d3} ;@ Deprecated 160: d1091b0c tstle r9, ip, lsl #22 164: bf581e6d svclt 0x00581e6d 168: cb01f801 blgt 0x7e174 16c: e005d5fa strd sp, [r5], -sl 170: 6b01f814 blvs 0x7e1c8 174: 6b01f801 blvs 0x7e180 178: d5f91e6d ldrble r1, [r9, #3693]! ; 0xe6d 17c: d3d64291 bicsle r4, r6, #268435465 ; 0x10000009 180: 00004770 andeq r4, r0, r0, ror r7 184: 24002300 strcs r2, [r0], #-768 ; 0xfffffd00 188: 26002500 strcs r2, [r0], -r0, lsl #10 18c: bf283a10 svclt 0x00283a10 190: d8fbc178 ldmle fp!, {r3, r4, r5, r6, r8, lr, pc}^ 194: bf280752 svclt 0x00280752 198: bf48c130 svclt 0x0048c130 19c: 4770600b ldrbmi r6, [r0, -fp]! 1a0: f005b51f ; <UNDEFINED> instruction: 0xf005b51f 1a4: bd1ffd62 ldclt 13, cr15, [pc, #-392] ; 0x24 1a8: bd10b510 cfldr32lt mvfx11, [r0, #-64] ; 0xffffffc0 1ac: fa8cf004 blx 0xfe33c1c4 1b0: f7ff4611 ; <UNDEFINED> instruction: 0xf7ff4611 1b4: f001fff5 ; <UNDEFINED> instruction: 0xf001fff5 1b8: f004f8ad ; <UNDEFINED> instruction: 0xf004f8ad 1bc: b403faaa strlt pc, [r3], #-2730 ; 0xfffff556 1c0: fff2f7ff ; <UNDEFINED> instruction: 0xfff2f7ff 1c4: f004bc03 ; <UNDEFINED> instruction: 0xf004bc03 1c8: 0000faaf andeq pc, r0, pc, lsr #21 firmware_ori-01.bin firmware_ori-02.bin Quote Link to comment Share on other sites More sharing options...
Restless Posted November 29, 2015 Share Posted November 29, 2015 4 hours ago, jayjay23 said: My guess is as follows, from the backside you can definitely see, GND and Vref and two going under the chip: Just need to find out which is clock and which is IO (measuring from connector to proper STM pins should give the answer), for me this means building an adapter, as it's different from my current board connector. 3 hours ago, electric_vehicle_lover said: @Restless, is possible for you to measure/follow the pins from the STM32F103 to the SWD conector so we can prepared any needed adapater? - thanks. Seems to me that the board have conectors but they also sent some kind of extension cable with different connectors in the end. So now we have a code to turn on or off the LEDs for battery charge indication. What do you guys think should be next code/step?? 4 hours ago, jayjay23 said: Do I see it right that the plugs are soldered? As they don't seem to have the male plastic part around it. I've seen at least one wheel were the plugs were indeed directly soldered onto a board :-) Sry guys i had not enough time this weekend to check out wich pin is CLCK / SWD :/ I'll try to find some time tmrw. (i guess the parcels should arrive tmrw. or tuesday at the german adresses, the one to Portugal probably takes a couple more days Yes the plugs are soldered directly to the board ... took me 3 minutes to figure that out i think thats pretty stupid. at least they come with ~5cm wires, which makes it nice as a dev env. Overall i have to admit that these boards look pretty well made for that price. I have seen worse things from chinese direct sellers. I'm just waiting for my ST-Link adapter (bought a chinese clone from banggood, Link hope it works, if not ill buy a original one) and my 2* 30V 5A power supply (a friend of mine (he is an elec. engineer) recommended this one: Link) And then i'm ready to code. As soon as we get the LED's working i would say we should decide between run the motor or read the sensors, i would say the sensors should be our next POI. The motor should be pretty easy. Quote Link to comment Share on other sites More sharing options...
OliverH Posted November 30, 2015 Share Posted November 30, 2015 6 hours ago, Restless said: Sry guys i had not enough time this weekend to check out wich pin is CLCK / SWD :/ I'll try to find some time tmrw. (i guess the parcels should arrive tmrw. or tuesday at the german adresses, the one to Portugal probably takes a couple more days Yes the plugs are soldered directly to the board ... took me 3 minutes to figure that out i think thats pretty stupid. at least they come with ~5cm wires, which makes it nice as a dev env. Overall i have to admit that these boards look pretty well made for that price. I have seen worse things from chinese direct sellers. I'm just waiting for my ST-Link adapter (bought a chinese clone from banggood, Link hope it works, if not ill buy a original one) and my 2* 30V 5A power supply (a friend of mine (he is an elec. engineer) recommended this one: Link) And then i'm ready to code. As soon as we get the LED's working i would say we should decide between run the motor or read the sensors, i would say the sensors should be our next POI. The motor should be pretty easy. Just ordered the OpenOCD Controller and need to buy the power supply. Need to pick up the parcels at the parcel station over the border this week. Looking forward to have some fun. Quote Link to comment Share on other sites More sharing options...
Chriull Posted November 30, 2015 Share Posted November 30, 2015 On 28. November 2015 um 10:06:43, Restless said: Hey guys Today i recived the boards! Actually they look pretty good. ... Thats maybe a little bit offtopic, but it looks like there is quite some spacing between some mosfets and the heatsink? If so, this could have quite some negative impact on thermal conductivity and lead to nasty overheating/destroyed mosfets? Quote Link to comment Share on other sites More sharing options...
Restless Posted November 30, 2015 Share Posted November 30, 2015 1 hour ago, Chriull said: Thats maybe a little bit offtopic, but it looks like there is quite some spacing between some mosfets and the heatsink? If so, this could have quite some negative impact on thermal conductivity and lead to nasty overheating/destroyed mosfets? The mosfets have some (let's call it "paper") between the heatsink to avoid short circuit. It should work, since i heard a lot of EUC use this "cheap" method Something we could improve, I'll mark that somewhere in the git repo. Maybe in a new one for Hardware-Dev, we probably need one later anyway. Quote Link to comment Share on other sites More sharing options...
jayjay23 Posted November 30, 2015 Author Share Posted November 30, 2015 The have two sheets of this rubbery tape (don't know if one would not also be enough). So boards arrived today, I think they are usable, have nothing tried yet, but measuring the connectors: Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted November 30, 2015 Share Posted November 30, 2015 @jayjay23 thanks for the SWD pinout. I am thinking for next step to prepare a code to run the motor with a low PWM duty-cycle like 10%. Quote Link to comment Share on other sites More sharing options...
jayjay23 Posted November 30, 2015 Author Share Posted November 30, 2015 Ok, the boards work if you don't switch them on before powering them up! First connect power and power up the power supply, then connect the switch. I tried with my motor and it works (with original firmware), but it's horribly difficult to balance them, the SP connector is for calibration, if bridged and powered on, the wheel spins in one direction then the other (with very moderate speed) then beeps, after that the board is calibrated, well you may know this behavior from other wheels already. I soldered the adapter I need, and it works right out of the box. The chips is locked, for all of you to try with openocd, the important command is init; halt; stm32f1x options_read 0 Unlocking it also works: init; halt; stm32f1x unlock 0 after which options read shows the correct flash size and so on. Flashing our current firmware, I plugged a LED directly into the LED plug, just to see something, and it also works, looks now like 1s. Regarding the further development, personally I would go for reading input, as this should be less dangerous in damaging something, but we could also work on different parts supporting each other and testing. With the motor I think doing a hall only driver should not be complicated, but doing a hall/back EMF switching driver could be more challanging, but we need to keep this in mind to not redevelop/redesign the code, so when you want to start with that, think how the position source can be switched on the fly. Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted November 30, 2015 Share Posted November 30, 2015 Thanks @jayjay23. I am ready to make the motor code using the halls. But I need to know how to read the current!! The current sensor is needed to avoid short circuits - the STM32F have a specific function to disable the switching mosfets when the current is over a specified value. Quote Link to comment Share on other sites More sharing options...
Donald1800 Posted November 30, 2015 Share Posted November 30, 2015 Since progress is inevitable with both software/firmware AND hardware/board designs, perhaps a generalized function block diagram with block I/O interface V/I/Imp. requirements may be more useful and practical than a detailed schematic of a current specific board. This approach would also allow future hardware/circuit designers to design better function blocks from better/more advanced components that could be assembled like Legos for a better controller board. Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted December 1, 2015 Share Posted December 1, 2015 I sent to github my first try to make the motor running at 10% PWM. On main() we have: motor_set_duty_cycle (100); // 100 --> 10% motor_start(); This set the duty cycle and start the motor. As soon the motor rotates, the signal on the hall sensor will change and the interrupt TIM3_IRQHandler is called: void TIM3_IRQHandler(void) { /* "Read" all sensors sequence and execute the BLDC coils commutation */ commutate (); Here the commutate() function will switch the right phases of the motor and will make it rotate to next stage (there are only 6 stages that repeats), then another interrupt, etc. This code I got from my last project and for some reason it uses a clock of 24MHz(??) but our current board uses 8MHZ internal oscillator. The setup of the timers must be revised for our clock. Also I get this error while linking: @jayjay23 Can you please try build the code and see if you get the same error? make all ..linking arm-none-eabi-ld -v src/gpio.o src/pwm.o src/motor.o src/main.o src/bldc.o src/hall_sensor.o src/spl/src/stm32f10x_gpio.o src/spl/src/stm32f10x_i2c.o src/spl/src/stm32f10x_dma.o src/spl/src/stm32f10x_rcc.o src/spl/src/stm32f10x_tim.o src/spl/src/misc.o src/spl/CMSIS/system_stm32f10x.o src/spl/CMSIS/core_cm3.o src/startup_stm32f10x_md.o -Tsrc/stm32_flash.ld -Larm-none-eabi-lib/gcc/arm-none-eabi/current -nostartfiles -o src/main.elf GNU ld (2.25-10ubuntu1+5build1) 2.25 src/bldc.o:(.bss+0x0): multiple definition of `GPIO_InitStructure' src/gpio.o:(.bss+0x0): first defined here src/pwm.o: In function `update_duty_cycle': /home/jpinto/generic-electric-unicycle/firmware/src/pwm.c:58: undefined reference to `__aeabi_ui2f' /home/jpinto/generic-electric-unicycle/firmware/src/pwm.c:58: undefined reference to `__aeabi_fmul' /home/jpinto/generic-electric-unicycle/firmware/src/pwm.c:58: undefined reference to `__aeabi_f2uiz' src/motor.o: In function `motor_get_speed': /home/jpinto/generic-electric-unicycle/firmware/src/motor.c:17: undefined reference to `__aeabi_ui2d' /home/jpinto/generic-electric-unicycle/firmware/src/motor.c:17: undefined reference to `__aeabi_dmul' /home/jpinto/generic-electric-unicycle/firmware/src/motor.c:17: undefined reference to `__aeabi_ddiv' /home/jpinto/generic-electric-unicycle/firmware/src/motor.c:17: undefined reference to `__aeabi_ddiv' /home/jpinto/generic-electric-unicycle/firmware/src/motor.c:17: undefined reference to `__aeabi_d2uiz' Makefile:59: recipe for target 'main.elf' failed make: *** [main.elf] Error 1 @Donald1800 if you think you can help, please tell us how and/or go ahead. Quote Link to comment Share on other sites More sharing options...
electric_vehicle_lover Posted December 1, 2015 Share Posted December 1, 2015 Ok, the code now builds correctly. I needed to include libgcc and the changes were this on Makefile: From this: LFLAGS = -Tsrc/stm32_flash.ld -L$(TCPREFIX)lib/gcc/arm-none-eabi/current -nostartfiles To this: LFLAGS = -Tsrc/stm32_flash.ld -L/usr/lib/gcc/arm-none-eabi/4.9.3 -lgcc -nostartfiles I had also an error on the code. I pushed to github. Next thing is to have the clock at max speed. I believe that now that processor is running at only 8MHz. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.