Porting Quantum Leaps to Arduino Micro?

Go To Last Post
23 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I'm working with the Arduino UNO, the C language and the Qunatum Leaps framework in my free time for only 3 years. I finished a project with a NeoPixel stripe on the UNO and would like to have it run on the Arduino Micro. But this isn't supported by the framework. I already found out how to adapt the environment variables in the QM tool according to the boards.txt. But the build process don't work.

 

Did anybody has adapted the framework to the Micro? I found some posts that mentioned the framework, so my hope is that somebody has already or is able to do it.

Last Edited: Tue. Oct 3, 2017 - 02:40 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe better to ask here: https://sourceforge.net/p/qpc/discussion/668726 - specific Quantum Leaps forum ... ?

 

EDIT

 

This forum has a specific section for Arduino: http://www.avrfreaks.net/forums/arduino

Last Edited: Mon. Oct 2, 2017 - 04:25 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Orje wrote:
But this isn't supported by the framework

Sounds like a question for the QL people!  Why not use an Arduino pro-mini, same cpu as the Uno, so it should be plug and play!

 

Jim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did already twice, but Miro wrote that they haven't enough time to port the framework to all Arduino microcontrollers and the UNO is the most popular.

I also asked in the Arduino forum, but no one answered eather. I'm pretty sad about it. If only someone could lead me the way.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pro mini? I take a look.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Orje wrote:
If only someone could lead me the way.

Perhaps it's time for you to step up and lead the way ... ?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I fear that I will have problems with the mini because it hasn't USB and the additionell break board has another chip. For that rason I would also have to edit the build and upload scripts that came with the framework. The error messages I get when I compile sound like problems with the missing ATmega16U2 for the USB on the Micro.


{{{ External tool "build"

INFO> Code generation started (06:48:34.968 )
INFO> Entire model: C:\Users\orje\Documents\Arduino\libraries\qpn_avr\examples\blinky\blinky_micro.qm
INFO> Code generation ended (time elapsed 0.000s)
INFO> 0 file(s) generated, 1 file(s) processed, 0 error(s), and 0 warning(s)

"%ARDUINO_SKETCHBOOK%\tools\utils\tclsh.exe" "%ARDUINO_SKETCHBOOK%\tools\scripts\build_avr.tcl" %PROJECT% "qpn_avr"
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/abi.cpp -o lib/abi.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/abi.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/CDC.cpp -o lib/CDC.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/CDC.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/HardwareSerial.cpp -o lib/HardwareSerial.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/HardwareSerial.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/HardwareSerial0.cpp -o lib/HardwareSerial0.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/HardwareSerial0.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/HardwareSerial1.cpp -o lib/HardwareSerial1.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/HardwareSerial1.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/HardwareSerial2.cpp -o lib/HardwareSerial2.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/HardwareSerial2.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/HardwareSerial3.cpp -o lib/HardwareSerial3.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/HardwareSerial3.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/IPAddress.cpp -o lib/IPAddress.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/IPAddress.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/main.cpp -o lib/main.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/main.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/new.cpp -o lib/new.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/new.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/PluggableUSB.cpp -o lib/PluggableUSB.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/PluggableUSB.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/Print.cpp -o lib/Print.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/Print.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/Stream.cpp -o lib/Stream.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/Stream.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/Tone.cpp -o lib/Tone.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-ar rcs lib/arduino.a lib/Tone.o
C:/assemble/Arduino/hardware/tools/avr/bin/avr-g++ -c -x c++ -mmcu=atmega32u4 -Os -Wall -Wno-attributes  -fno-exceptions -ffunction-sections -fdata-sections -I. -IC:/assemble/Arduino/hardware/arduino/avr/cores/arduino -IC:/assemble/Arduino/hardware/arduino/avr/cores/../variants/micro -IC:/assemble/Arduino/hardware/arduino/avr/libraries/EEPROM -IC:/assemble/Arduino/hardware/arduino/avr/libraries/HID -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SoftwareSerial -IC:/assemble/Arduino/hardware/arduino/avr/libraries/SPI -IC:/assemble/Arduino/hardware/arduino/avr/libraries/Wire  -DF_CPU=16000000L C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/USBCore.cpp -o lib/USBCore.o
In file included from C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/USBAPI.h:44:0,
                 from C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/USBCore.cpp:20:
C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/USBCore.cpp:74:29: error: 'USB_VID' was not declared in this scope
  D_DEVICE(0xEF,0x02,0x01,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,ISERIAL,1);
                             ^
C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/USBCore.h:267:61: note: in definition of macro 'D_DEVICE'
  { 18, 1, USB_VERSION, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs }
                                                             ^
C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/USBCore.cpp:74:37: error: 'USB_PID' was not declared in this scope
  D_DEVICE(0xEF,0x02,0x01,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,ISERIAL,1);
                                     ^
C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/USBCore.h:267:66: note: in definition of macro 'D_DEVICE'
  { 18, 1, USB_VERSION, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs }
                                                                  ^

====>ERROR: 'C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/USBCore.cpp' failed to compile

}}} External tool finished normally with status 1

 

Last Edited: Tue. Oct 3, 2017 - 05:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

Perhaps it's time for you to step up and lead the way ... ?

Please believe me I try, but I have no idea how to go on. To come to that point where Qunatum Leaps is, would propably cost me to much time. Like I said, I do this in my free time and are not the youngest anymore. laugh

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But you said it works on an UNO, which has not USB native to the M328, as it has a usb/serial bridge chip.  The pro-mini is the same but uses a separate usb/bridge.

The same code that runs on the UNO will run native on the pro-mini/usb-bridge combo.   Don't try to run the Arduino micro code on the mini....

 

 

Jim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Will I not have trouble with the usb/brigde? It seems not to have the Arduino ATmega16U2 chip?

Last Edited: Mon. Oct 2, 2017 - 05:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You "may" need a com driver for whichever usb/serial bridge you choose, but that is no different then any other PC accessory you plug in to a PC.....

when all is said and done, they all look like a serial COM port to the pc (plug and play).  

Or does your application (what ever that is, as you have not said) need USB for something other then bootloading the code.

 

Jim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, I don't use USB for anything else. This is my little project https://github.com/orje/LEDviaApp-prototyp-

 

I thank you for your ideas, Jim! But I would rather prefer to learn or to get help how to edit the scripts that Quantum Leaps use, because for my next project I want to use the framework to program the ZUMO robot from Pololu.

It is sad to me that obviously so little people uses such a good framework with so many goodies on the Arduino plattform.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So what do you see as the Big Benefit(s) of this framework?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First I have to say, that I'm not a professionally programmer. So I might have a different view as a professional.

I like

- the finite state concept

- the possibility for hierarchically state arrangement that saves a lot of context flags and repetitions (for example, only 1 emergency button linked to the topstate is needed and so mustn't be linked to every substate)

- the entry and exit actions when entry or exit a state

- the event driven programming (the controller only works when necesarry and can go to sleep between. Good for battery)

- no debouncing or creating signal edge because of transition when the event occurs

- the different possibilities creating events by I/O, time ticks or even by code

- passing parameters with events

- ability to use code in state and transitions

- having guards for transitions to control them

- the code compiling out of the modeling tool

- the modeling tool for a quicker and better overview of a program logic instead of 100's of lines (the code is "hided" in the states and shown if selected)

- the framework and the modeling tool together help/force me very much to structure my program

- putting enumerations into prom

 

 

negativ:

- much to learn for a newbie (like me)

 

Last Edited: Tue. Oct 3, 2017 - 05:11 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

This forum has a specific section for Arduino: http://www.avrfreaks.net/forums/arduino

I'M new in this forum. Maybe a moderator can move my thread to the Arduino part.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Orje wrote:
I don't use USB for anything else.

 

Then why even attempt to link in the USB stuff if its only used by the bootloader, and is not supported by QL???

 

I would suggest taking this to the QL forum for further help.

 

Jim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Orje wrote:
C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/USBCore.cpp:74:29: error: 'USB_VID' was not declared in this scope

In USB the VID (vendor ID) and PID (Product ID) are numbers assigned per product. For example you can see a list here:

 

http://www.linux-usb.org/usb.ids

 

So for example :

03eb  Atmel Corp.
    ....
	2104  AVR ISP mkII

 

is saying that Atmel own vendor ID 0x3EB and one of their products is "AVR ISP mkII" that they have assigned Product ID 0x2104

 

Registered users of USB pay usb.org for a vendor ID and then they can assign their own PIDs within it.

 

So it looks to me like the code you are building here is expecting to see a user created header file or something in which a particular vendor (you) with a particular product has defined USB_VID and USB_PID to make use of the numbers you have paid for. That turns "generic" USB code into something specific for your company and one of your products.

 

In the files:

In file included from C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/USBAPI.h:44:0,
                 from C:/assemble/Arduino/hardware/arduino/avr/cores/arduino/USBCore.cpp:20:

I bet you find there is a #include of some .h file in which values for USB_VID and USB_PID are either commented or waiting for you to fill in the relevant numbers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks very much for your help.
Unfortunately I'm busy for the next 2 or 3 days and will reply then.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Hello, I'm back. I was able to improve a little bit.

 

I solved the USB_VID and USB_PID error message by including them into the Environment Variables of the build command of the QM tool.

The next error message was:

lib/arduino.a(PluggableUSB.o): In function `PluggableUSB()':
PluggableUSB.cpp:(.text._Z12PluggableUSBv+0xc): undefined reference to `__cxa_guard_acquire'
PluggableUSB.cpp:(.text._Z12PluggableUSBv+0x2c): undefined reference to `__cxa_guard_release'

Fortunatally I found an information for solving this too.

I had to move a static declaration out of a function in luggableUSB.cpp.

from:

PluggableUSB_& PluggableUSB()
{
	static PluggableUSB_ obj;
	return obj;
}

to:

static PluggableUSB_ obj;
PluggableUSB_& PluggableUSB()
{
	return obj;
}

Now the build process is running to the end, but the upload doesn't work (it's also done out of the QM tool with a batch file).

It stucked and when I stopped it manually i got the error message:

}}} External tool returned error: 1
}}} External tool crashed with status 62097

I looked how the Arduino IDE does the upload and edited the avrdude parameter in the batch file from:

"%ARDUINO_SKETCHBOOK%\tools\utils\avrdude" -p %BOARD_MCU% -c arduino -P %BOARD_COM% -b %BOARD_BAUD% -D -v -C

to:

"%ARDUINO_SKETCHBOOK%\tools\utils\avrdude" -p %BOARD_MCU% -c avr109 -P %BOARD_COM% -b %BOARD_BAUD% -D -v -C

I uploaded even with manually reset, but got the error message:

Connecting to programmer: .avrdude: butterfly_recv(): programmer is not responding

I learned in the internet that the upload process of the Micro and Leonardo is different to the UNO. The USB has to be reseted.

I found a batch code from https://github.com/p1ne/arduino-leonardo-uploader/blob/master/windows/upload.bat and included it in the batch file.

before:

setlocal

set PATH=%ARDUINO_HOME%

"%ARDUINO_SKETCHBOOK%\tools\utils\avrdude" -p %BOARD_MCU% -c arduino -P %BOARD_COM% -b %BOARD_BAUD% -D -v -C "%ARDUINO_HOME%\hardware\tools\avr\etc\avrdude.conf" -U flash:w:bin\%1.hex:i

endlocal

now:

setlocal
for /f "tokens=1* delims==" %%I in ('wmic path win32_pnpentity get caption  /format:list ^| find "Arduino Micro"') do (call :resetCOM "%%~J")
:continue

:: wmic /format:list strips trailing spaces (at least for path win32_pnpentity)
for /f "tokens=1* delims==" %%I in ('wmic path win32_pnpentity get caption  /format:list ^| find "Genuino Micro bootloader"') do (call :setCOM "%%~J")

:: end main batch
goto :EOF

:resetCOM <WMIC_output_line>
:: sets _COM#=line
setlocal
set "str=%~1"
set "num=%str:*(COM=%"
set "num=%num:)=%"
set port=COM%num%
echo %port%
mode %port%: BAUD=1200 parity=N data=8 stop=1
goto :continue

:setCOM <WMIC_output_line>
:: sets _COM#=line
setlocal
set "str=%~1"
set "num=%str:*(COM=%"
set "num=%num:)=%"
set port=COM%num%
echo %port%
goto :flash

:flash

setlocal
set PATH=%ARDUINO_HOME%
"%ARDUINO_SKETCHBOOK%\tools\utils\avrdude" -p %BOARD_MCU% -c avr109 -P %BOARD_COM% -b %BOARD_BAUD% -D -v -C "%ARDUINO_HOME%\hardware\tools\avr\etc\avrdude.conf" -U flash:w:bin\%1.hex:i
endlocal

Now I get the error message:

find: Arduino Micro: No such file or directory
find: Genuino Micro bootloader: No such file or directory

Looks like it doesn't work right. But now I'm again at the end of my Latin (German phrase).

I can't find yet how the Arduino people are doing that upload with the software reset and so on.

Can someone help me or give me a hint? (Found nothing in the avr-libc manual or WinAVR or other sources)

Last Edited: Sun. Oct 8, 2017 - 05:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Okay,

made the upload. The mistake in my thoughts was to tell avrdude the "normal" COM port "Arduino Micro" (COM6 in my case) but no the upload port "Genuino Micro Bootloader" (COM7 in my case). So  with the manually reset it does the upload.

 

(Unfortunatelly the code works totally slow. About 3 minutes between LED on and off. I probably made same mistakes with the timer when I ported the model/sketch from UNO to Micro. I will try to find out.)

 

So the only question for this thread is, how to edit the upload batch, so that the reset for the COM port change is made by it, because I want to build the Micro into a case. 

Last Edited: Mon. Oct 9, 2017 - 04:52 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look at the Arduino schematics for their reset circuit - it consists of a capacitor.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

Look at the Arduino schematics for their reset circuit - it consists of a capacitor.

Hi Kartman, what do you mean? I found examples in the internet where people are doing a reset electronically. But I'm looking for a solution, like the Arduino IDE. On the https://www.arduino.cc/en/Guide/ArduinoLeonardoMicro is written "... Note that the auto-reset is initiated when the computer opens the serial port at 1200 baud and then closes it...". In that way the code for the Arduino Micro is uploaded out fo the IDE.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah -yes. I forgot you are using a 32u4.