Code Monkey home page Code Monkey logo

Comments (8)

vedderb avatar vedderb commented on July 21, 2024

Hi,
An offset of a few 100mA is normal. The shunts are 0.001 ohm, so at 0.5 A there is only 0.0005 V across them that is centred and amplified. With such a small motor, I suggest that you use a larger value shunt, maybe 0.01 ohm.

However, for the startup, that is not likely to be the problem. It is very important that you get the motor parameters right. There is an autodetect-function in BLDC_Tool that you can use, but I haven't documented how to do that yet. If you get the parameters completely wrong, you are lucky if the motor runs at all.

from bldc.

ledvinap avatar ledvinap commented on July 21, 2024

Yes, I know this that this current is small, but it is only for testing.

I was just surprised, the offset is considerably larger than noise and similar on both channels. Reading the documents, maybe input bias current of amplifier can be the reason (input is disconnected during calibration, input bias is specified < 100uA, bias difference would be hopefully much smaller).

In my case it's quite difficult to get autodetect to spin up the motor, but reported values seem quite consistent when returned. Usually motor just resonates. I'll try increasing the current.

from bldc.

vedderb avatar vedderb commented on July 21, 2024

The motor must be able to spin up during auto detect, otherwise it won't work. Do you happen to use an hdd-drive motor? Auto-detect does not work well for them for some reason. Probably because they need so low current that the current control loop does a bad job with the varying offset.

The current is calibrated right after startup, so then I usually get less than 50mA offset. When the PCB changes temperature after running the motor for a while, the offset usually goes up to a few 100 mA. I have been experimenting a lot with the offset calibration, and so far this is the best I could do. Maybe I could add some runtime offset estimation (by e.g. sampling while no PWM is applied and taking the average), but for the motors I have been running this offset is not really a problem.

What do you mean by that the input is disconnected during calibration? You must have input power connected when the stm32 boots. If you, for example, only have the programmer connected to power the stm32 and the drv8302 has no voltage, the current offset calibration will fail.

from bldc.

ledvinap avatar ledvinap commented on July 21, 2024

I have one 22xx '100w' airplane motor and DMB0224C10002 CL B 1607 24V (from microchip kit, probably).

In my case I get +400mA on both phases right after startup, before starting the motor. This value is quite stable (with my currents board temperature stays the same).

With DC_CAL high, 'device shorts inputs of shunt amplifiers and disconnects loads'. So voltage caused by input bias current of sense amplifiers is not compensated. Maybe that is causing offset I see ... I'll try to measure the voltage tomorrow ..

from bldc.

ledvinap avatar ledvinap commented on July 21, 2024

I did some testing.

The bias current is creating voltage on filter resistors, about 3mV (30uA), but this current is exactly the same on both inputs, so voltage difference is zero.

With DCCAL_ON() there is about 2mV increase in current amplifier output voltage (200mA on 1uR shunt). Measured with Metex M-4660A, so this value is a bit above measurement error.

Also phase1 offset is about -1.6A, phase2 is +200mA. I interpreted phase order wrong in previous post.

So phase 2 is perfect, phase 1 is off by 1.8A. This is 18mV difference, 22lsb, way larger than +-2lsb typical for ADC.

I am probably doing some stupid mistake or maybe my board is wrong ..

from bldc.

ledvinap avatar ledvinap commented on July 21, 2024

Found something .. I switched to bipolar PWM mode during testing ...

do_dc_cal in bipolar mode runs with curr_samp_volt=1, so cur0_sum value is calculated from ADC_Value[ADC_IND_CURR1]; instead from ADC_GetInjectedConversionValue(ADC1, ADC_InjectedChannel_1);

In synchronous PWM mode I get expected offset of -200mA (3lsb) on both channels.

Strange thing is that in bipolar mode there is 20 count difference on curr0_offset when I measure twice, once with DCCAL_ON() and just after that with DCCAL_OFF();

from bldc.

ledvinap avatar ledvinap commented on July 21, 2024

I'll need to understand code better. Thanks for help, it's probably OK to close this ..

from bldc.

vedderb avatar vedderb commented on July 21, 2024

Sampling the currents and voltages is tricky. The sampling is synchronized to the PWM period and sampled at different points depending on the duty cycle, the commutation step and the switching frequency. Since the current shunts are on the low side and not directly on the motor phases, they have to be sampled when the low-side FETs are on. Getting the sampling right is among the things I have spent the most time on.

from bldc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.