Question about ADC Injected channelks configuration

Discussions regarding the Field Oriented Control (FOC) implementation on the VESC.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
att
Posts: 2
Joined: 24 Mar 2016, 12:06
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Question about ADC Injected channelks configuration

Postby att » 24 Mar 2016, 12:19


rew
Posts: 943
Joined: 25 Mar 2016, 12:29
Location: Delft, Netherlands.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Question about ADC Injected channelks configuration

Postby rew » 27 Mar 2016, 09:12

There is code to sample the current twice and then average the results. It looks to me as if this was an attempt to get less noise, but it was abandoned because it didn't help much. So the option to sample twice is turned off by default.

The second set of initializations (with the "2" in there), are therefore redundant: The hardware is never instructed to use the registers that are initialized with those statements.

(In your "why can't it be... " you are quoting exactly the lines that are usually redundant).

att
Posts: 2
Joined: 24 Mar 2016, 12:06
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Question about ADC Injected channelks configuration

Postby att » 27 Mar 2016, 22:04


rew
Posts: 943
Joined: 25 Mar 2016, 12:29
Location: Delft, Netherlands.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Question about ADC Injected channelks configuration

Postby rew » 28 Mar 2016, 09:05

I THINK the second sampling is deactivated with DEFINEs. Doublecheck for yourself.

That code is only executed once at startup. So removing code is going to make the startup of your ESC about half a microsecond faster. Why bother?

I don't really know the answer to your second question. I suspect:

If you have the counter repeat with 100 count intervals it counts from 0 to 99. So you should be careful not to request a trigger at "100", because that will never happen. If had written that, I could have written -2 just to be extra sure. On the other hand, interrupts and stuff might happen at "ARR-1" so this places this event a little away from the others.

But I'm just guessing. Never looked at that code in detail.

ViennaTom
Posts: 41
Joined: 21 Apr 2016, 13:06
Location: Austria/Vienna
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Question about ADC Injected channelks configuration

Postby ViennaTom » 10 May 2016, 17:13

i guess
dmaStreamRelease(STM32_DMA_STREAM(STM32_DMA_STREAM_ID(2, 4)));
should also be removed within mcpwm_foc.c
as no stream is allocated as in mcpwm.c for the adc_int_handler
greets
Tom

ViennaTom
Posts: 41
Joined: 21 Apr 2016, 13:06
Location: Austria/Vienna
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Question about ADC Injected channelks configuration

Postby ViennaTom » 20 May 2016, 21:16

Hi !
I tried to switch to ADC_TripleMode_RegSimult_InjecSimult mode (in FOC mode) dropping the second PWM channel for injected triggering and to be able to handle a future sensor with ADC3.

ADC_CommonInitStructure.ADC_Mode = ADC_TripleMode_RegSimult_InjecSimult;
...
ADC_ExternalTrigInjectedConvEdgeConfig(ADC1, ADC_ExternalTrigInjecConvEdge_Falling);
ADC_InjectedSequencerLengthConfig(ADC1, 1);
ADC_InjectedSequencerLengthConfig(ADC2, 1);
ADC_InjectedSequencerLengthConfig(ADC3, 1);

ST reference manual quotes:
"Triple ADC mode
At the end of conversion event on ADC1, ADC2 or ADC3:
• The converted data are stored into the ADC_JDRx registers of each ADC interface.
• A JEOC interrupt is generated (if enabled on one of the three ADC interfaces) when the
ADC1/ADC2/ADC3’s injected channels have all been converted."
So this should sample all three ADC channels simultaneously when ADC1 is triggered injected ?!
BUT this works at low speeds only and when faster the motors stalls - any idea why ?

Another idea was to use 28 cycle sampling time for injected conversions to improve readings and stay with 15 cycles for regular conversions - does not seem to be supported ?!


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Return to “FOC”

Who is online

Users browsing this forum: No registered users and 2 guests