Current offset and gain

General topics and discussions about the VESC and its development.
matjaz1
Posts: 2
Joined: 22 Aug 2017, 13:49
Location: Ljubljana

Current offset and gain

Postby matjaz1 » 22 Aug 2017, 13:51

Hello to all,

I made a circuit board, based on VESC design, but I changed the current measurement method. My question is, where could I change the current offset and gain parameters?
Thank you for your answer.

Best Regards,
Matjaz

rew
Posts: 943
Joined: 25 Mar 2016, 12:29
Location: Delft, Netherlands.

Re: Current offset and gain

Postby rew » 22 Aug 2017, 19:04

In hwconf there are files for each of the hardware options. The easy way out is to modify the one for the design that you copied the hardware from.

Slightly more work is to make a definition file for the hardware that you made and add it to the makefile and things like that. Start with a copy of the hardware that you started out with.

The current sensitivity is in the .h file.

matjaz1
Posts: 2
Joined: 22 Aug 2017, 13:49
Location: Ljubljana

Re: Current offset and gain

Postby matjaz1 » 23 Aug 2017, 12:50

Thank you for a quick response rew.
I use hw_410.h, since i'm a beginner in programing i have searched where i can modify the current offset and gain but without luck... Could you please be more specific, which parameters should i change in order to get it work.

Here is a link to Benjamin's github hw_410.h file --> Link to https://github.com/vedderb/bldc/blob/master/hwconf/hw_410.h

Thanks,
Matjaz

rew
Posts: 943
Joined: 25 Mar 2016, 12:29
Location: Delft, Netherlands.

Re: Current offset and gain

Postby rew » 24 Aug 2017, 07:04

line 84 and 87.

The code more or less assumes that you have a resistor and a voltage amplifier (GAIN). So the default setup, a 1 mOhm shunt resistor results in a sensitivty of 1mV per A. (V/A is otherwise known as Ohm). Next there is a GAIN of 10x so we get: 10mV/A. That is what hte current line 84 and 87 are saying.

Suppose you have an ACS7xx chip with 20mV/A sensitivty, you simply specify a 20x gain or (but not both) a 2 mOhm shunt.

kitewinder
Posts: 19
Joined: 29 May 2017, 20:47
Location: Bordeaux

Re: Current offset and gain

Postby kitewinder » 24 Aug 2017, 08:06

And another simple questions : how can we "flash" those changes on hwconf into the vesc ?

rew
Posts: 943
Joined: 25 Mar 2016, 12:29
Location: Delft, Netherlands.

Re: Current offset and gain

Postby rew » 24 Aug 2017, 09:03

Forgot to mention: DC offset of the current measurement is measured at startup.

You compile the project. I just type "make" and it works.

kitewinder
Posts: 19
Joined: 29 May 2017, 20:47
Location: Bordeaux

Re: Current offset and gain

Postby kitewinder » 24 Aug 2017, 09:39

Sorry Rew but I'm afraid it does not help.
I know it is for sure really obvious but I just need the starting point.
you modified the hw_410.h file after having downloaded it. Then what did you do with that files? You compile it with what ? how can the board be aware of that changed files ? how do you "flash the board" ?

rew
Posts: 943
Joined: 25 Mar 2016, 12:29
Location: Delft, Netherlands.

Re: Current offset and gain

Postby rew » 24 Aug 2017, 17:27

On Ubuntu, you have to install the arm compiler. I do not remember the commands. It was years ago that I installed it and when I upgrade, it automatically installs the same packages that I had.

Then in the directory above the hwconf files you type "make". Then make will inspect the files and determine which ones need to be recompiled. (if you change a hwconf file, or if it's your first time, usually all of them.)

Then you end up with a file build/BLDC<something>.elf This can be flashed into the processor. I use "st-util" to manage my STLINK programmer and then flash it using gdb (arm-none-eabi-gdb to be precise). Most others, I'm told, use "openocd", but I had some trouble using that and st-util worked for me.

If you have a real VESC there should be a bootloader in your VESC so that you can upload the new firmware using BLDC-tool. However I have never used that.

kitewinder
Posts: 19
Joined: 29 May 2017, 20:47
Location: Bordeaux

Re: Current offset and gain

Postby kitewinder » 25 Sep 2017, 19:11

Thanks Rew for your answer, that helps a lot !


Return to “General”

Who is online

Users browsing this forum: No registered users and 3 guests