Shop OBEX P1 Docs P2 Docs Learn Events
Universal Motor Driver - Dual wheel steering, motor control, and position tracking Objects for P2 - Page 2 — Parallax Forums

Universal Motor Driver - Dual wheel steering, motor control, and position tracking Objects for P2

2

Comments

  • @CJMJ

    The variable is an old LAMBDA model lr-602a-fm: https://www.recycledgoods.com/lambda-dc-power-regulator-lr-602a-fm/ I got both from All Electronics in Van Nuys, Ca when I lived there it is variable up to 15 volts and 15 amps.
    The 24 output: https://www.alliedelec.com/product/mean-well/sp-240-24/70069596/

    All Electronics:
    https://www.allelectronics.com/

    Ask for Fabien or Mike. Tell them Martin Montague sent you. I have worked with them for 10 years. Really great folks. Everything is wholesale.
    Martin.

  • @CJMJ

    24 volts: https://www.alliedelec.com/product/mean-well/sp-240-24/70069596/

    variable to 20 vdc: https://www.ebay.com/itm/254542594417

    I purchased these at All Electronics in Van Nuys, Ca. The Lamda is old but works great. The other is out of production. Maybe a similar item would help.

  • Maybe a stupid question for which I apologise, but can this object with BLDC motors be used for precise static positioning like steppers?

  • dgatelydgately Posts: 1,621
    edited 2022-10-05 20:58

    Stephen,

    EDIT... After hooking up the WXY pins to a scope, noticed some activity in the scope and touching the motor shaft there is a short burst forward and then backward (15 seconds apart, which was the MTR_HOLD_AT_SPEED_IN_SEC setting). Created a repeating loop & set MTR_HOLD_AT_SPEED_IN_SEC to different values, but results of the short forward/backward bursts are the same. Video of the HDMI screen: https://youtu.be/70F3EqzD09I
    END-EDIT

    Not getting motor response when trying to use the driver with: Parallax BLDC, 24V motor, SKU 750-90020... I do get response from the hall sensors, but the motor does not turn using the demo_single_motor.spin2 source (latest from P2-BLDC-Motor-Control-main ZIP download).

    I noticed that PWR_24p0V is stated as "NOT SUPPORTED", but actually does appear to be supported in the isp_bldc_motor.spin2 sources.

    isp_bldc_motor_userconfig.spin2 states:

    ' ADDING SUPPORT as we go...
    '   WARNING: NOT SUPPORTED YET:  (if you use a NOT SUPPORTED value, motor won't go...)
    '      NO SUPPORT FOR   PWR_6p0V
    '      NO SUPPORT FOR   PWR_7p4V
    '      NO SUPPORT FOR   PWR_24p0V
    

    BUT, isp_bldc_motor.spin2 code appears to support PWR_24p0V:

        if user.MOTOR_TYPE == MOTR_DOCO_4KRPM
            CASE userVoltage
                ' NOTE 6.0V is not legal for this motor
                PWR_7p4V:
                PWR_11p1V:
                PWR_12p0V:
                PWR_14p8V:
                PWR_18p5V:
                PWR_22p2V:
                PWR_24p0V:
                ' NOTE 25.9V is not legal for this motor
                OTHER:
                    legalVoltage := INVALID_VOLTAGE
    

    This config reports hall sensor activity, but the motor does not spin:

        MOTOR_TYPE = MOTR_DOCO_4KRPM
        ONLY_MOTOR_BASE = PINS_P16_P31
        DRIVE_VOLTAGE = PWR_24p0V
        WHEEL_DIA_IN_INCH = 0.0   ' no wheel attached (floating point constant)
    

    Do I need to use this config?:

        MOTOR_TYPE = MOTR_DOCO_4KRPM
        ONLY_MOTOR_BASE = PINS_P16_P31
        DRIVE_VOLTAGE = PWR_12p0V          <== use 12V versus 24 ???
        WHEEL_DIA_IN_INCH = 0.0   ' no wheel attached (floating point constant)
    

    Still trying different configs...

    dgately

  • @dgately there is the beginning of support for 24v but it’s not complete. Stay below 24v for now…. Always more to be implemented. 😋

  • @"Stephen Moraco" said:
    @dgately there is the beginning of support for 24v but it’s not complete. Stay below 24v for now…. Always more to be implemented. 😋

    Well, thats good :) But, even using the config set to DRIVE_VOLTAGE = PWR_12p0V, I get only a short pulse of movement. About an 8th turn forward, then backward the same amount. I get the same pulse no matter what value of MTR_HOLD_AT_SPEED_IN_SEC...

    The forward pulse (I think, but could have been a backwards) looks like this for the WVU outputs to the motor:

    After sending the pulse, it waits for the correct amount of time with the following code, but the pulse is "long gone!".

    wheel.stopAfterTime(MTR_HOLD_AT_SPEED_IN_SEC, wheel.DTU_SEC)      ' set to hold at speed for MTR_HOLD_AT_SPEED_IN_SEC Sec
    waitUntilMotorDone()
    

    Note:

    Yellow probe == yellow (W)
    Blue probe == blue (V)
    Purple probe == green (U)

  • dgatelydgately Posts: 1,621
    edited 2022-10-07 15:23

    Setting up the driver for debugging, the console returns the following (note: I have added some DEBUG statements so I would know where in the code we are at any one time. And, voltage, current and watts are displayed, while waiting for the motor to finish...)...

    The motor is obviously faulting, but does this debug data give a clue as to why? Is the "MOTR_DOCO_4KRPM" config applicable to the Parallax BLDC motor in the recent Mystery Box? At 12V?

    * ~ % /Users/.../flexprop/bin/loadp2 -k -p /dev/cu.usbserial-P8y12uhc -b230400 /Users/.../Downloads/P2-BLDC-Motor-Control-main/src/demo_single_motor.binary -9/Users/.../Downloads/P2-BLDC-Motor-Control-main/src -t; osascript -e 'tell application "flexprop" to activate'; exit 0
    ( Entering terminal mode.  Press Ctrl-] or Ctrl-Z to exit. )
    
    Cog0  INIT $0000_0000 $0000_0000 load
    Cog0  INIT $0000_0404 $0000_0000 load
    Cog0  *VAL* legalVoltage = 4
    Cog1  INIT $0000_0404 $0000_6020 load
    Cog0  *VAL* legalMotor = 1
    Cog2  INIT $0000_73E0 $0000_A494 load
    Cog0  MOT: fwdDegrees = 307, offset_fwd = $DA4F_A4FA
    Cog0       revDegrees = 53, offset_rev = $25B0_5B05
    Cog0   - Calc FRAME: frame_cnt = 6_136
    Cog0  * init values dead_gap = 70, pwm_limit = 3_033, adc_fram = 6_136, duty_min = 1_600, duty_max = 24_264
    Cog0  *      values duty_up = 18, duty_dn = 4, cfg_ctcks = 135_000, motr_ctcks = 2_789
    Cog0  *VAL* legalVoltage = 4
    Cog0  * ENTRY CFG selectedPower = 4
    Cog0  * EXIT 2 CFG userSelectedVolts = 4
    Cog0  -MOT- targetIncre = 0
    Cog0  * Motor COG #3
    Cog3  INIT $0000_86C0 $0002_25E0 load
    Cog4  INIT $0000_0404 $0002_24B8 load
    
    Cog0  * -------------
    Cog0  * MOTR DAT values: (&hall) = $0002_260C, (&hall) = $0000_0003, $0000_0000, $0000_085C, $0000_0050
    Cog0  * MOTR VAR values: (&tvRpm_x10) = $0002_262C, (&tvRpm_x10) = $0000_0000, $0000_0000, $0000_0000, $0000_0000
    Cog0  * NAMEs SOURCE1: (&nameTitle1) = $0000_8508, (&nameTitle1) = $4D, $6F, $74, $6F, $72, $20, $44, $72, $69, $76, $65, $00, $68, $61, $6C, $6C, $00, $70, $6F, $73, $00, $64, $75, $74, $79, $00, $65, $72, $72, $00, $6C, $6F, $6F, $70, $54, $69, $63, $6B, $73, $00, $73, $74, $61, $74, $65, $00, $46, $41, $55, $4C, $54, $00
    Cog0  * NAMEs SOURCE2: (&nameTitle2) = $0000_8540, (&nameTitle2) = $4D, $6F, $74, $6F, $72, $20, $53, $65, $6E, $73, $65, $00, $52, $50, $4D, $20, $31, $30, $74, $68, $73, $00, $52, $50, $4D, $00, $63, $6E, $74, $73, $2F, $73, $65, $63, $00, $64, $65, $6C, $74, $61, $00, $41, $6D, $70, $00, $6D, $61, $78, $41, $6D, $70, $00, $52, $50, $4D, $62, $31, $30, $74, $68, $73, $00
    Cog0  * NAMEs SOURCE3: (&nameTitle3) = $0000_8582, (&nameTitle3) = $4D, $6F, $74, $6F, $72, $20, $52, $61, $74, $65, $28, $2E, $31, $29, $00, $52, $50, $4D, $00, $63, $6E, $74, $73, $2F, $73, $65, $63, $00, $66, $2F, $73, $00, $4D, $50, $48, $00, $6B, $4D, $2F, $48, $00, $6D, $6D, $2F, $73, $00, $41, $6E, $67, $6C, $2F, $31, $30, $6B, $00
    Cog0  * -------------
    Cog0  * MOTR DL title: (&pTitlesAr) = $0002_23F4, (&pTitlesAr) = $0000_8508, $0000_8540, $0000_8582, $0000_0007
    Cog0  * MOTR DL VarCt: (&pVarCtAr) = $0002_2404, (&pVarCtAr) = $0000_0007, $0000_0007, $0000_0007
    Cog0  * MOTR DL Names: (&pNamesAr) = $0002_2410, (&pNamesAr) = $0000_8514, $0000_8519, $0000_851D, $0000_8522, $0000_8526, $0000_8530, $0000_8536, $0000_854C, $0000_8556, $0000_855A, $0000_8563, $0000_8569, $0000_856D, $0000_8574, $0000_8591, $0000_8595, $0000_859E, $0000_85A2, $0000_85A6, $0000_85AB, $0000_85B0
    Cog0  * MOTR DL Values: (&pValsAr) = $0002_2464, (&pValsAr) = $0002_260C, $0002_2610, $0002_2614, $0002_2618, $0002_261C, $0002_2624, $0002_2628, $0002_262C, $0002_2630, $0002_2638, $0002_263C, $0002_2608, $0002_265C, $0002_2660, $0002_2634, $0002_2654, $0002_2644, $0002_2648, $0002_264C, $0002_2650, $0002_2658
    Cog0  * -------------
    Cog0  * MOTR PARM values: (&nGroups) = $0002_26F0, (&nGroups) = $0000_0003, $0002_23F4, $0002_2410, $0002_2404, $0002_2464
    Cog0  * -------------
    Cog0  * MOTR Sent: nGroups = 3, pGroupTitles = $0002_23F4, pGroupNames = $0002_2410, pGroupVarCts = $0002_2404, pGroupVars = $0002_2464
    Cog0  * =============
    
    Cog0  * Received: nGroups = 3, pGroupTitles = $0002_23F4, pGroupNames = $0002_2410, pGroupVarCts = $0002_2404, pGroupVars = $0002_2464
    Cog0  * Starting test in 2 secs...
    Cog0  * Motor ready, let's drive!
    Cog0  setMaxSpeed() limitSpeed = 100
    Cog0  * FORWARD!...
    Cog0  -MOT- driveAtPower() limitPwr = 80, ramp_fast = 50_000, ramp_slo = 12_000
    Cog0  -MOT- targetIncre = 267_433_251
    Cog0  -MOT- driveAtPower() EXIT 
    Cog0  *  power: pwrVal = 80
    Cog0  *  current: curVal = 1_301
    Cog0  *  watts: wVal = 0
    Cog0  * -------------
    Cog0  * MOTR DAT values: (&hall) = $0002_260C, (&hall) = $0000_0005, $0000_0000, $0000_0A34, $FFFF_FFB4
    Cog0  * MOTR VAR values: (&tvRpm_x10) = $0002_262C, (&tvRpm_x10) = $0000_0000, $0000_0000, $0000_0000, $0000_0000
    Cog0  * NAMEs SOURCE1: (&nameTitle1) = $0000_8508, (&nameTitle1) = $4D, $6F, $74, $6F, $72, $20, $44, $72, $69, $76, $65, $00, $68, $61, $6C, $6C, $00, $70, $6F, $73, $00, $64, $75, $74, $79, $00, $65, $72, $72, $00, $6C, $6F, $6F, $70, $54, $69, $63, $6B, $73, $00, $73, $74, $61, $74, $65, $00, $46, $41, $55, $4C, $54, $00
    Cog0  * NAMEs SOURCE2: (&nameTitle2) = $0000_8540, (&nameTitle2) = $4D, $6F, $74, $6F, $72, $20, $53, $65, $6E, $73, $65, $00, $52, $50, $4D, $20, $31, $30, $74, $68, $73, $00, $52, $50, $4D, $00, $63, $6E, $74, $73, $2F, $73, $65, $63, $00, $64, $65, $6C, $74, $61, $00, $41, $6D, $70, $00, $6D, $61, $78, $41, $6D, $70, $00, $52, $50, $4D, $62, $31, $30, $74, $68, $73, $00
    Cog0  * NAMEs SOURCE3: (&nameTitle3) = $0000_8582, (&nameTitle3) = $4D, $6F, $74, $6F, $72, $20, $52, $61, $74, $65, $28, $2E, $31, $29, $00, $52, $50, $4D, $00, $63, $6E, $74, $73, $2F, $73, $65, $63, $00, $66, $2F, $73, $00, $4D, $50, $48, $00, $6B, $4D, $2F, $48, $00, $6D, $6D, $2F, $73, $00, $41, $6E, $67, $6C, $2F, $31, $30, $6B, $00
    Cog0  * -------------
    Cog0  * MOTR DL title: (&pTitlesAr) = $0002_23F4, (&pTitlesAr) = $0000_8508, $0000_8540, $0000_8582, $0000_0007
    Cog0  * MOTR DL VarCt: (&pVarCtAr) = $0002_2404, (&pVarCtAr) = $0000_0007, $0000_0007, $0000_0007
    Cog0  * MOTR DL Names: (&pNamesAr) = $0002_2410, (&pNamesAr) = $0000_8514, $0000_8519, $0000_851D, $0000_8522, $0000_8526, $0000_8530, $0000_8536, $0000_854C, $0000_8556, $0000_855A, $0000_8563, $0000_8569, $0000_856D, $0000_8574, $0000_8591, $0000_8595, $0000_859E, $0000_85A2, $0000_85A6, $0000_85AB, $0000_85B0
    Cog0  * MOTR DL Values: (&pValsAr) = $0002_2464, (&pValsAr) = $0002_260C, $0002_2610, $0002_2614, $0002_2618, $0002_261C, $0002_2624, $0002_2628, $0002_262C, $0002_2630, $0002_2638, $0002_263C, $0002_2608, $0002_265C, $0002_2660, $0002_2634, $0002_2654, $0002_2644, $0002_2648, $0002_264C, $0002_2650, $0002_2658
    Cog0  * -------------
    Cog0  * MOTR PARM values: (&nGroups) = $0002_26F0, (&nGroups) = $0000_0003, $0002_23F4, $0002_2410, $0002_2404, $0002_2464
    Cog0  * -------------
    Cog0  * MOTR Sent: nGroups = 3, pGroupTitles = $0002_23F4, pGroupNames = $0002_2410, pGroupVarCts = $0002_2404, pGroupVars = $0002_2464
    Cog0  * =============
    Cog0  * stop motor at motorStopMSecs = 7_399, now: timeNow = 2_399
    Cog0  * wait until motor finishes...
    Cog4  -MOT- targetIncre = 0
    Cog0  * Motor stopped! wait 4ms
    Cog0  * BACKWARD!...
    Cog0  -MOT- driveAtPower() limitPwr = -80, ramp_fast = 50_000, ramp_slo = 12_000
    Cog0  -MOT- targetIncre = -267_433_251
    Cog0  -MOT- driveAtPower() EXIT 
    Cog0  *  power(-): pwrVal = 80
    Cog0  *  current: curVal = 1_304
    Cog0  *  watts: wVal = 0
    Cog0  * -------------
    
    ... the ABOVE repeats in a LOOP...
    
    
  • Sorry for not reading all the details above, but is your power source able to supply the required amps at 12V. Ie. Your not hitting a current limit.

    You might want a 2 or 3amp @12v capable power source.

  • The other critical factor is the deadtime software setting. I think the rev A 64010 needed about 250ms, and the rev B about 50ms.

    I guess the driver auto-configures the deadtime, but figured it's worth mentioning as that and the power source can cause what you are seeing.

  • @VonSzarvas said:
    Sorry for not reading all the details above, but is your power source able to supply the required amps at 12V. Ie. Your not hitting a current limit.

    You might want a 2 or 3amp @12v capable power source.

    My power supply was set to 5 amps…

  • @VonSzarvas said:
    The other critical factor is the deadtime software setting. I think the rev A 64010 needed about 250ms, and the rev B about 50ms.

    I guess the driver auto-configures the deadtime, but figured it's worth mentioning as that and the power source can cause what you are seeing.

    I'm using an Edge (P2-EC) and Mini Breakout (64019)... Should that be closer to the A 64010 rev B and require 50ms or totally different? Note: DEBUG stated: "init values dead_gap = 70", during test runs.

  • That deadtime is only relevant to the mosfets on the motor driver. Try bumping that 70ms to 150 or 250. Sadly those are just faded re-collections....

    If it would help I could go run the code with the same motor tomorrow and compare notes.

  • @VonSzarvas said:
    If it would help I could go run the code with the same motor tomorrow and compare notes.

    That would be great!

  • Consider it done!

  • Stephen MoracoStephen Moraco Posts: 300
    edited 2022-10-08 19:47

    @knivd said:
    Maybe a stupid question for which I apologise, but can this object with BLDC motors be used for precise static positioning like steppers?

    Hmm, good question? Here's my thinking...

    Things that help:
    (1) The driver API supports feedback in turns of hall tics and can stop the motor after N tics.
    (2) The driver supports active braking - can use power to keep the motor in a stopped position

    Things that might hinder:
    But... the distance between hall tics varies by motor type. (e.g., the 6.5" is 4° while the DocoEng motor is 15°) so the step size will be in terms of these rotational distances.
    Also, your power choice (how fast you attempt to move between steps) would affect the behavior.

    So, in the end, this would need to be experimented with to see what type of precise control we do have. Does this help?
    Lastly, our motor API is purposefully rich to support many different areas of investigation and use.

    -Stephen

  • @dgately said:

    @VonSzarvas said:
    If it would help I could go run the code with the same motor tomorrow and compare notes.

    That would be great!

    Hi @dgately !

    Little video of my setup here:
    https://drive.google.com/file/d/1hakKCSTq7dIXYdTmfSwb2LhSer8xMWr8

    Code archive attached (from PropellerTool). This is the same archive as was attached to the QuickByte demo page, but I figured it would be good to be certain we are both using the same code.

    If you have things set-up the same way (with 12V source) and run the "demo_single_motor.spin2" code, does that work for you ?
    If yes, at line 86-ish you can increase the motor speed limit from 5 to 50 or more, and see if things are still good.

    Did you already check for signals out of the motor drive terminal blocks? And signals at the hall headers?

  • dgatelydgately Posts: 1,621
    edited 2022-10-10 23:36

    @VonSzarvas said:
    Code archive attached (from PropellerTool). This is the same archive as was attached to the QuickByte demo page, but I figured it would be good to be certain we are both using the same code.

    I tried your code and the motor is now spinning (yay!) The code I had used came from the propeller code on GitHub.

    If you have things set-up the same way (with 12V source) and run the "demo_single_motor.spin2" code, does that work for you ?

    Yes, my setup is like yours and now the motor is spinning (there is an issue that may be a hint of the problems). See below):

    If yes, at line 86-ish you can increase the motor speed limit from 5 to 50 or more, and see if things are still good.

    Yes, that speeds up the motor, but it seems to hang, waiting for the motor to finish past the time set by MTR_HOLD_AT_SPEED_IN_SEC (I set it from 5 to 15 seconds for testing). Let me test that some more as I'm trying to run the motor at different speeds within a loop.

    Did you already check for signals out of the motor drive terminal blocks? And signals at the hall headers?

    Yes, When I was testing the original code from GitHub, I put the signals onto my scope and could see the short burst of pulses, but they would not last as long as MTR_HOLD_AT_SPEED_IN_SEC. But, with your code version, the motor keeps spinning. Now, just have to figure out why waitUntilMotorDone() is not returning.

    So, the issue that may hold a clue is displayed here (this is your version of the code but notice the HDMI display):

    Notice that the HDMI display is rather wonky... The only difference that I find is in 'your' p2textdrv.spin2 file, compared to the one from GitHub (FileMerge says):

    The code with Mac CR line endings versus Windows CRLF line endings is compiling differently? That's the only difference that I can see. I ran FileMerge on other project files and did not find actual code differences, just the line-endings. Not sure how this caused a problem with the motor driver... When I compile your motor driver and demo code, the motor works, but the HDMI display is broken. I replaced p2textdrv.spin2 with the GitHub code and the HDMI display is correct. Perplexing, for sure!

  • How did you manage to get a file with Classic Mac line endings?

  • @Electrodude said:
    How did you manage to get a file with Classic Mac line endings?

    Well, several of the files in VonSzarvas' ZIP file have Mac line-endings (CR)...

     % hexdump -C -n 300 .../demo_single_motor\ -\ Archive\ \ \[Date\ 2022.10.10\ \ Time\ 20/p2textdrv.spin2
    00000000  27 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |'***************|
    00000010  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
    *
    00000040  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 0d  |***************.|     <== '0d' macOS line-end
    00000050  27 2a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |'*              |
    ...
    

    BTW: I am also using macOS! If I edit and save any files with typical Mac editors (subEthaEdit, TextEdit, etc.) they will also get macOS line-endings. However, I have not edited the files from the ZIP!

  • Really? I thought only Classic Mac OS used Mac line endings, and that they switched to Unix endings when OSX came out, and I used to use Mac before I switched to Linux. Huh.

  • dgatelydgately Posts: 1,621
    edited 2022-10-11 13:43

    @Electrodude said:
    Really? I thought only Classic Mac OS used Mac line endings, and that they switched to Unix endings when OSX came out, and I used to use Mac before I switched to Linux. Huh.

    You are correct! Testing this, modern macOS-created text-only files use just a line-feed (0a), as does Linux/Unix. Not sure how the files above have (0d) at line ends.

    % hexdump -C -n 300 testText.txt 
    00000000  54 68 69 73 20 69 73 20  61 20 74 65 73 74 0a 41  |This is a test.A|
    00000010  6e 6f 74 68 65 72 20 6c  69 6e 65                 |nother line|
    0000001b
    

    Happily, flexprop will actually replace all the x0d's with x0a's if you edit and re-save the files in its editor!

  • Those files came via a GitHub code zip download; possible that process mangled them somehow. :neutral:
    I'm running Win11 and PropellerTool.

  • All in thread -FYI

    I'm going to check the repo today to see what's going on. When I find those files I'll correct them in the repo. I'll report back here what the conclusion is.

  • Stephen MoracoStephen Moraco Posts: 300
    edited 2022-10-11 23:21

    Hi all,

    Ok, nothing was found! When I pull a fresh copy of the repo and check all .spin2 files they have the correct line endings for my OS (macOS, LF line terminators)
    I also unpacked the latest release .zip and .tar.gz files and they are all LF-only terminated as well.
    So I don't have a clue why some people are getting CR-only vs CRLF or LF-only line terminators. Does anyone else have any ideas?

    I was wrong. My check tool was broken, is working now.

    Let's try this again. The BLDC repo is fine, LF-only (mine) and CRLF (not mine) files however, the release .zips have mostly CR-only files and I have no idea how this happened. I'm working on fixing the .zip files.

    Final State of Things
    Ok, in the end, I was able to download the .zip archives, repair the files containing CR-only line endings, rebuilt the .zip files and replaced the .zip files in the release with the new .zip files. All should be good now. Please let me know if that's not the case.

    I'll be watching for this issue in releases from now on.

  • dgatelydgately Posts: 1,621
    edited 2022-10-11 21:50

    Could you check the ZIP file from post #47?

  • @"Stephen Moraco" said:
    Final State of Things
    Ok, in the end, I was able to download the .zip archives, repair the files containing CR-only line endings, rebuilt the .zip files and replaced the .zip files in the release with the new .zip files. All should be good now. Please let me know if that's not the case.

    I downloaded the demo-archive-set.zip, version 3.0.0 from: https://github.com/ironsheep/P2-BLDC-Motor-Control/releases

    When I try to compile demo_single_motor.spin2 in flexprop on macOS as well as on WIN 11, I get the following errors:

    "./flexprop/bin/flexspin" -2 -l --tabs=2 -D_BAUD=230400 -O1    --charset=utf8 -I "./flexprop//include" -I "./flexprop/include/spin" -I "./flexprop/include/libsimpletext" -I "./Downloads/spcog_v1_0/tunes" -I "./Documents/P2ESCode/p2library" -I "./Documents/PropSpinCode/SpinObjects" -I "./flexprop/include/filesys/fatfs" -I "./Documents/P2ESCode/P2Custom"  "./Downloads/demo-archive-set/demo_single_motor.spin2"
    Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2022 Total Spectrum Software Inc.
    Version 5.9.18-beta-v5.9.16-69-gbd2c222b Compiled on: Oct 13 2022
    ./Downloads/demo-archive-set/demo_single_motor.spin2:35: error: unknown identifier ONLY_MOTOR_BASE in class isp_bldc_motor_userconfig
    ./Downloads/demo-archive-set/demo_single_motor.spin2:35: error: unknown identifier ONLY_MOTOR_BASE in class isp_bldc_motor_userconfig
    demo_single_motor.spin2
    |-isp_bldc_motor_userconfig.spin2
    |-isp_hdmi_debug.spin2
    |-|-p2textdrv.spin2
    |-|-|-p2videodrv.spin2
    |-isp_bldc_motor.spin2
    |-|-isp_bldc_motor_userconfig.spin2
    |-|-isp_dist_utils.spin2
    child process exited abnormally
    Finished at Thu Oct 13 18:34:13 2022
    

    So, I ran FileMerge on that copy of isp_bldc_motor_userconfig.spin2, which has Unix/Liux line-ending (CR) and a copy that had WIN-style (CRLF) line-ending (which I named: "isp_bldc_motor_userconfigMINE.spin2"). That's the only difference! The copy with WIN-style (CRLF) compiles without issue (on macOS & WIN11):

    "./flexprop/bin/flexspin" -2 -l --tabs=2 -D_BAUD=230400 -O1    --charset=utf8 -I "./flexprop//include" -I "./flexprop/include/spin" -I "./flexprop/include/libsimpletext" -I "./Downloads/spcog_v1_0/tunes" -I "./Documents/P2ESCode/p2library" -I "./Documents/PropSpinCode/SpinObjects" -I "./flexprop/include/filesys/fatfs" -I "./Documents/P2ESCode/P2Custom"  "./Downloads/demo-archive-set/demo_single_motor.spin2"
    Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2022 Total Spectrum Software Inc.
    Version 5.9.18-beta-v5.9.16-69-gbd2c222b Compiled on: Oct 13 2022
    demo_single_motor.spin2
    |-isp_bldc_motor_userconfigMINE.spin2
    |-isp_hdmi_debug.spin2
    |-|-p2textdrv.spin2
    |-|-|-p2videodrv.spin2
    |-isp_bldc_motor.spin2
    |-|-isp_bldc_motor_userconfig.spin2
    |-|-isp_dist_utils.spin2
    ieee32.c
    demo_single_motor.p2asm
    Done.
    Program size is 140020 bytes
    Finished at Thu Oct 13 18:43:05 2022
    

    FileMerge says:

  • @"Stephen Moraco" said:
    So, in the end, this would need to be experimented with to see what type of precise control we do have. Does this help?
    Lastly, our motor API is purposefully rich to support many different areas of investigation and use.

    -Stephen

    Seems promising. I am in options for motor control, but mostly for precise positioning and not so much for continuous rotation. Hall sensors are inherently inaccurate; they create a field, which can be detected from two sides. Optical sensors are much better in that regard, although they are also not ideal.

  • @dgately said:

    @"Stephen Moraco" said:
    @dgately there is the beginning of support for 24v but it’s not complete. Stay below 24v for now…. Always more to be implemented. 😋

    Well, thats good :) But, even using the config set to DRIVE_VOLTAGE = PWR_12p0V, I get only a short pulse of movement. About an 8th turn forward, then backward the same amount. I get the same pulse no matter what value of MTR_HOLD_AT_SPEED_IN_SEC...

    The forward pulse (I think, but could have been a backwards) looks like this for the WVU outputs to the motor:

    After sending the pulse, it waits for the correct amount of time with the following code, but the pulse is "long gone!".

    wheel.stopAfterTime(MTR_HOLD_AT_SPEED_IN_SEC, wheel.DTU_SEC)      ' set to hold at speed for MTR_HOLD_AT_SPEED_IN_SEC Sec
    waitUntilMotorDone()
    

    Note:

    Yellow probe == yellow (W)
    Blue probe == blue (V)
    Purple probe == green (U)

    That is the same issue I have with see attachment. I varied the volts from 5 to 24 and get the 1/4 turn then stops.

  • @"Stephen Moraco"

    @"Stephen Moraco" said:
    @pilot0315 I can guarantee that the driver will not work with that motor until adjustments are made to built-in tables and power limits. There will be a number of experiments to determine what needs to be added.

    Did you wander across my page introducing the concepts we need for adding a new motor?

    I wandered over to that page yesterday. Makes sense to me. I will probably have questions. Was a good tutorial. Clear and concise.
    Thank you.
    Martin

  • @dgately said:
    Could you check the ZIP file from post #47?

    Dennis, yes the .zip file in #47 has the bad line endings too.

Sign In or Register to comment.