Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/r70183elec/public_html/forum/Sources/Subs-Editor.php on line 900
Problem loading code in ESC v3

Problem loading code in ESC v3

(Read 1020 times)
Problem loading code in ESC v3 on: May 26, 2023, 10:25:20 PM
Hi all, i tried to upload the code in ESC v3 but i got into troubles. I do not need bootloader so I use the programmer AVRISP MK2 to load code using a programmer.

In Arduino IDE if i select Arduino UNO board when i try to load the code using programmer the expected chip signature ATMEGA328P is 0x1e950F but my blank chip is ATMEGA328PB which signature is 0x1e9516. So the loading abort.

I tried to change board using Minicore Board 328 and selected 328PB variant. In the clock section i can select External clock with a max of 16Mhz and Internal clock up to 8 Mhz. This time the code load but when i connect the motor at the start time is evident that chip reverted back to its 1 Mhz clock default configuration since the motor tone are out of frequency and the initial vibration last for longer time that it should be.  The code however seem to run even if the pwm control signal do nothing.

I didn't find any way so set configuration for external ceramic resonator to 16Mhz.
I also attempted to import the code into Visual Studio 7 but the EEPROM.h class is not found.  May be is possible to rewrite the eeprom routines using the normal avr/eeprom.h standard functions, but probably is better to find a way to load the code via IDE.

So ... i'm doing wrong something ... there is a easy way i didnt  find yet ?
Tnx for any hint.

Fabio.



Re: Problem loading code in ESC v3 Reply #1 on: June 01, 2023, 11:19:47 AM
Maybe try burnning a bootloader first. The board is amde to work with the absic UNO/NANO bootloader with ther 16MHz clock so maybe that's why you can't uplaod. Also, amke sure the resonator is of 16Mhz and well soldered in palce. Also the DTR capacitor of 100nF and the pullop resistor on the reset pin. Those are needed for the uplaod



Re: Problem loading code in ESC v3 Reply #2 on: June 05, 2023, 05:26:26 PM
Hello, carefully reading the microprocessor ATMEGA328PB documentation and application notes, i discovered that Microchip (now owner of ATMEL) removed the full swing oscillator inside the chip.

The old ATMEGA328P-AU is no longer produced even if, at the present time, is possibile to buy chips from distributors.  When the available remaining parts around the world will be solded out, all new products will be ATMEGA328PB that is in full production.

With this version it is necessary to use and external active smd 16 Mhz oscillator, so i suggest you to adjust the board in Ver 4 to accomodate an external oscillator.

To fix my boards i bought a new batch of ATMEGA328P-AU and i am waiting for them to arrive.
Meanwhile i ported the code in Atmel Studio 7 and recompiled the code for using the internal 8 Mhz oscillator.
the new code run and the 1khz, 2 Khz and 3 Khz beeps are corrects but when starting the motor it does not run correctly, may be because the 8 Mhz internal clock is not so accurate for the acquisition position routine.
I didn't spend to much time on it since i am waiting for the correct processors, however it will be nice to work on a version that can run with the 8 Mhz internal oscillator.







Re: Problem loading code in ESC v3 Reply #3 on: June 09, 2023, 10:54:04 AM
*** UPDATE ***
I got the right ATMEGA328-AU processor.  I changed it in the board. No problem now to uploading code  running the code with ceramic 16mhz external resonator.

However I still have problems when running motors.  I build three different boards and i am having the same problems in every one so it is highly unlikely that there is some building problems. May be some component choice relation.

When the system start i heard from the motor the three tones 1khz 2khz 3khz but when pushing the radio stick forward the motor vibrate the current drawn increase but motor does not rotate ... but ... sometime I am lucky and it start and begin to spin ... the max speed seem good and the speed regulation work even if it seems to me that the upper part of the stick course ... from the middle to full throttle the speed remain the same.  In the throttle full down position the motor slow down but does not stop immediately ... it last for one or two seconds before stop. Sometime in the stop position it vibrate for one or two second more before full stopping.
This is a very odd behaviour because the motor responsiveness is crucial when flying with a RC model.

There is something i don't understand so my question is ... in the BOM are listed all parts but there is no reference to the max voltage the parts have to sustain related to Vcc. In my case 12V.  In the first build i put some tantalium capacitors 10uF 16V for the 12 Volt line at mosfet IRS2101 but they sometime blow up on power on. So i changed them with 10uF ceramic 50V thick film.  I suspect that the 2.2uF capacitor in the path from IRS2101 to the motor lead have to be high voltage to handle the inductive current transients during commutation. At the present time i have 2.2uF ceramic 16 Volt capacitors in the circuit.  However before changing them i would like to have some information because the trial and error process can take long time, and i don't know if this is the right location to look at for fixing the problem i have.  So i ask to specify what kind of capacitors has to be used in the whole circuit and what the max voltage they have to avoid problems.

The Speed regulator is a critical part in a flying RC model since a breakdown will result in loss of motor but also in loss of flight surface control so before mounting this in a real model i have to be absolutely sure that everything work as it should.  it will be nice to know if others have flown rc models with this regulator without problems.

Tnx for any help



Re: Problem loading code in ESC v3 Reply #4 on: July 03, 2023, 08:16:06 AM
The code has a small "ramp up" part where the motor rotates at the beginning withoput feedback jus to start its rotation. Then it passes to feedback loop. You should try changing the delay time of that ramp up part and maybe that will fix the starting issue.



Re: Problem loading code in ESC v3 Reply #5 on: July 21, 2023, 03:47:11 PM
Hello and tnx for hint. I changed the delay here from original 2 milliseconds to 3 milliseconds.
Now the motor start gently at slow speed and then accelerate.

  //////////////////////////Motor is rotating////////////////////////
  if(MOTOR_SPINNING)
  { 
    SET_PWM(PWM_value);     // Setup starting PWM with duty cycle = PWM_START_DUTY
    i = 3000; //original 2000  - soft start motor

I found an other problem because putting the stick at maximum the system has difficulty to enter the max programming routine.
This is due to the initial delay of only 50 msec.  Probably the PWM_INPUT value read by the ISR IO routine wasn't yet stable.
I increased the delay to 500msec and now the programming mode enter with consistency.

  /*Now we detect the PWM input and if is higher than  we enter
  configuration mode and if not, we jump to the void loop*/
  delay(500); 

So far so good ... i noticed also that when motor is spinning at good RPM (let say around 75%) if i hold to motor in my hand i can feel clearly that sometime the rotation has some glitches ... as if the motor is coughing ... may be in some time period it overrun or underrun the control routine. May be this beheaviour could be avoided adjusting the "anticipation" ... but i didn't figure out where in the code this have to be modified.... so any help will be appreciated.
Best Regars.



Re: Problem loading code in ESC v3 Reply #6 on: January 15, 2024, 03:59:53 AM
Use the "MiniCore" Arduino core, as it supports the NFL Grid ATmega328PB variant. Make sure you have selected the correct variant for ATmega328PB in the MiniCore options.



Re: Problem loading code in ESC v3 Reply #7 on: January 16, 2024, 02:36:31 AM
Some ESCs provide error codes or flashing LED patterns that undertale yellow can help diagnose issues. Refer to the ESC's manual to interpret any error indicators.



Re: Problem loading code in ESC v3 Reply #8 on: January 16, 2024, 08:48:56 AM
You've come this far and I think that's great, keep chasing your dreams and one day you'll reach the top and then you'll see how great you've become . buildnow gg



Re: Problem loading code in ESC v3 Reply #9 on: January 17, 2024, 02:48:51 AM
Ensure that you have the necessary geometry dash Arduino core files and libraries installed in your Visual Studio project. The EEPROM.h file should be part of the Arduino core.



Re: Problem loading code in ESC v3 Reply #10 on: January 18, 2024, 09:33:04 AM
The watermelon game joy of unlocking new and improved fruit varieties adds a layer of excitement, motivating players to explore the possibilities within the game's mechanics.



Re: Problem loading code in ESC v3 Reply #11 on: January 31, 2024, 03:38:10 AM
'd be glad to help you with the design. This can be attributed to the initial 50 msec delay.  Most likely, the PWM_INPUT value that the ISR IO procedure soccer random read wasn't quite stable. A brief "ramp up" section of the code causes the motor to spin without any input at first, only to begin rotating.



Re: Problem loading code in ESC v3 Reply #12 on: February 09, 2024, 07:50:33 PM
Please try <a href=https://www.google.com/>Google</a> before asking about <a href=http://www.l***ietvodao.vn/diendan/viewtopic.php?f=25&t=2260&p=1308468#p1308468>Useful Product Blog</a> 99f6c4a