#avr Logs

May 12 2019

#avr Calendar

12:20 AM ville: rue_mohr: it's an arduino micro which has an atmega32u4 in it
12:59 AM rue_mohr: ok
12:59 AM rue_mohr: what are you trying to program it with?
01:02 AM ville: so far i've tried connecting it through its builtin usb port directly then using arduino ide or avrdude and recently i bought an avrispmkii clone to try that method out
01:02 AM rue_mohr: no, do you have a programmer?
01:02 AM ville: re-read
01:03 AM rue_mohr: usbasp or avrisp?
01:03 AM rue_mohr: ok, you did the avrisp wrong then
01:03 AM ville: well that's where i ran into the udev bug
01:03 AM rue_mohr: you have a .hex file right?
01:04 AM rue_mohr: not likley...
01:04 AM rue_mohr: its not supposed to be a serial device
01:04 AM ville: it's confirmed already
01:04 AM rue_mohr: ok, all my avrisp mkII work fine
01:04 AM rue_mohr: your using linux?
01:04 AM ville: yes i am on linux
01:04 AM ville: it's not an avrispmkii, it's a clone
01:05 AM rue_mohr: doubt it matters
01:05 AM ville: http://and-tech.pl/wp-content/uploads/downloads/2013/12/AVRProg_USB_v3.pdf this one
01:06 AM rue_mohr: avrdude -c avrisp2 -P usb -p m32u4 -e -U flash:w:main.hex
01:06 AM rue_mohr: what does it say?
01:07 AM ville: yeah i can seemingly get things uploaded through it. but there're also bunch of errors as a result from avrdude. going to take me a few moments to setup the devices and do a copypasta
01:11 AM ville: https://paste.debian.net/1083556/
01:37 AM rue_shop1: iiinteresting
01:38 AM rue_shop1: just for kicks, you have tried a different cable, right?
01:45 AM ville: no, but also which cable? the usb cable between the computer and the programmer, or the cable between the programmer and the arduino
01:46 AM rue_shop1: computer to programmer
01:46 AM ville: i just bought the usb cable few days ago when i got the programmer
01:47 AM rue_shop1: sometimes cables are bad
01:47 AM rue_shop1: I'v had lots of surprises
01:48 AM rue_shop1: do you ahve another you can try?
01:48 AM ville: there seems to be some kind of newer firmware for the programmer, but they seem to require some program called FLIP to update it and windows which i don't have access to
01:50 AM ville: wonder why that program in particular and not say avrdude can be used
01:52 AM rue_shop1: flip runs on linux
01:52 AM rue_shop1: verry odd to need to change the firmware on a programmer
01:52 AM rue_shop1: even the usbasp I got works
01:53 AM nohit: he bought the worst programmer
01:53 AM rue_shop1: toms is a avrisp mk2 and its got no problems
01:54 AM rue_shop1: ever, its one of my fav programmers
01:54 AM rue_shop1: ville, idea
01:54 AM nohit: i think these work okay https://www.ebay.com/p/Atmel-at-AVRISP-AVR-ISP-MKII-In-system-Programmer-Atavrisp2-AVRISPmkII-Compliant/1239188921?iid=121935139852
01:54 AM rue_shop1: have an arduino around?
01:54 AM ville: i only have that one arduino micro
01:54 AM rue_shop1: ah, its not an avr is it?
01:55 AM ville: it uses an atmega32u4
01:55 AM rue_shop1: its not the one your trying to program tho, right?
01:55 AM ville: it is
01:55 AM rue_shop1: uh
01:55 AM rue_shop1: did it come with an arduino bootloader on it?
01:55 AM ville: the programmer uses at90usb162
01:56 AM rue_shop1: did the arduino come with an arduino bootloader on it?
01:56 AM ville: yes it has an arduino bootloader on it i believe
01:56 AM rue_shop1: ok, well why dont we just do that then
01:56 AM ville: "do that"?
01:56 AM rue_shop1: when you plug in that arduino by its usb, does it come up as a serial device?
01:57 AM ville: sure it shows up as /dev/ttyACM*
01:57 AM rue_shop1: ok!
01:57 AM rue_shop1: so
01:57 AM ville: as i said that doesn't work either
01:57 AM rue_shop1: avrdude -c arduino -P /dev/ttyACM~ -b 57600 -p m32u4 -e -U flash:w:main.hex
01:57 AM rue_shop1: there are 4 baud rates arduino use
01:58 AM rue_shop1: which one did you try
01:58 AM ville: is that a literal ~ or meant as a placeholder for me to fill in?
01:58 AM rue_shop1: placeholder
01:58 AM rue_shop1: there be no magic tonight
02:00 AM rue_shop1: I wonder whats got less latency, an interrupt or a while(io_port_bit_is_high); loop
02:04 AM ville: https://paste.debian.net/1083560/
02:06 AM rue_shop1: yea
02:06 AM ville: what baud rates do you suggest i test with?
02:06 AM rue_shop1: you have to hold down the reset,
02:06 AM rue_shop1: then run avrdude
02:07 AM rue_shop1: and release the reset really quick
02:07 AM rue_shop1: just after avrdude starts
02:07 AM rue_shop1: try again
02:08 AM ville: if i hold the reset there won't be /dev/ttyACM* entry for the device
02:08 AM rue_shop1: hmm
02:08 AM rue_shop1: good point
02:08 AM ville: i press the reset, then the built-in led flashes rapidly, indicating it's in bootloader mode as far as i understand, then hit enter on the avrdude command
02:08 AM rue_shop1: lets try the toher buad rates
02:09 AM rue_shop1: try with 38400
02:09 AM rue_shop1: and 115200
02:09 AM rue_shop1: usually the arduino using 115200 dont need to be reset (?)
02:10 AM rue_shop1: all my arduino use a CH340 so I dont run into this
02:16 AM ville: seems like its now gotten it self in some kind of poor state and no matter avrdude just can't find the /dev/ttyACM* entry, even if i can see it in `ls`
02:17 AM rue_mohr: dmesg
02:18 AM ville: yeah i could see the device come in dmesg and/or udevadm, avrdude just always failed with:
02:19 AM ville: avrdude: ser_open(): can't open device "/dev/ttyACM1": No such file or directory
02:19 AM ville: or ACM2, which ever i could see come up, as there's currently an annoying habbit of it switching from one to the other
02:20 AM rue_mohr: hmm show me the dmesg line?
02:20 AM rue_mohr: yea it'll switch if it dosn't know where the old device is
02:21 AM ville: https://paste.debian.net/1083564/
02:21 AM rue_mohr: ok, so its acm2
02:22 AM ville: on that particular occasion. like i said it switches around possibly every time i hit reset, but i was watching which it was and even then avrdude would fail with that for some reason. like i the device is in some weird state now seemingly
02:23 AM rue_mohr: ok, so which baud rates did you try?
02:24 AM ville: 38400, 57600, those reported the similar errors to: https://paste.debian.net/1083560/ trying 115200 couldn't get past the complaint about ser_open()
02:27 AM ville: ok now i got 115200 to repeat the errors from https://paste.debian.net/1083560/
02:27 AM rue_mohr: hmmm
02:30 AM ville: if i change the programmer from arduino to avr109 i can get it to report some progress
02:31 AM ville: what was the fourth baud rate you suspected?
02:32 AM rue_mohr: 19200
02:33 AM ville: https://paste.debian.net/1083566/
02:34 AM ville: gets me bit further with -c avr109 -b 19200
02:36 AM ville: if i am interpreting the light right on the arduino sometime during the reading part it drops out of the booloader mode
02:36 AM ville: bootloader
02:43 AM ville: out of close to 50 tries probably managed to get one go through with out errors so far
02:43 AM ville: not very enjoyable development experience if i have to try to upload ~50 times to try running.
02:46 AM ville: suppose i'll just accept i've bought 50 euros worth of poor paper weights and move on
02:46 AM rue_mohr: once you get the combination its nothing
02:46 AM rue_mohr: why you got a m32u4 I dont know
02:47 AM ville: for no particular reason other than the arduino micro it self seemed like a good candidate: supposedly could be programmer through the built-in usb port
02:48 AM ville: why would using an atmega32u4 rise an eyebrow?
02:49 AM rue_mohr: built in usb is a problem and overhead
02:50 AM ville: well i need an usb connection anyways. it's going to be a usb device
02:50 AM rue_mohr: a converter is less overhead and more reliable
02:51 AM rue_mohr: if you dont need it to emumberate an a specific usb ID
03:02 AM nohit: you just bought bad programmer, that's all
03:02 AM nohit: programming avrs is easy af
03:03 AM ville: that could very well be, but it doesn't explain why i can't get uploads to go through reliably the arduino micro's usb port either
03:04 AM nohit: buy a good programmer, a chip(s), breadboard and go from there
03:04 AM ville: the programmer and the arduino use different usb cables, one has mini-b and the other has a micro-b ports. suppose i could still have two bad usb cables. or bad usb cable and a bad programmer or...
03:06 AM ville: i don't doubt programming avr is difficult. it's the hardware side that's failing right now
03:06 AM ville: err don't doubt it's easy
03:09 AM rue_mohr: if you had bought an usbasp and a arduino pro mini you would be fine
03:09 AM nohit: is your goal to learn low level programming or to just create a quick one off project ?
03:10 AM nohit: if its the latter i would suggest nucleo + stm32cubeide, you can get it on linux these days
03:11 AM nohit: usb would be very easy with the ready made libraries
03:12 AM ville: just creating some devices for my own use. so i suppose one-off. i've 25+ worth of programming experience already
03:15 AM ville: and i rather now use "yet another ide" that won't do things the way i've my day-to-day editor configured
03:15 AM ville: not
06:24 AM rue_shop1: ville, uh dude, DONT use atmel studio
06:25 AM rue_shop1: I just write everything in C and use a makefile
07:19 AM ville: that's what i said pretty much. yes i don't use arduino ide or atmel studio.
08:20 AM nohit: atmel studio doesnt even work on linux so that was a poitless remark by rue
08:21 AM nohit: but like i said if you want just things to work use stm32 and their tools
08:21 AM nohit: also insane debugging capabilties
08:23 AM nohit: also free middlewares like usb, tcp/ip, rtos, filesystem etc.
09:04 AM ville: nohit: i'll take a peek at those. regular gcc has support for those cpus?
09:04 AM nohit: sure
09:08 AM ville: nohit: i am trying to build a wearable device clipped to my headphones, which would track my head orientation, and would connect to my computer as a regular usb device. what would be a good board for that?
09:11 AM nohit: just buy one of the nucleo boards. it has programmer/degbugger built-in. use the stm32mcuFinder, set your parameters and it gives you the cheapest mcu that has your features. then find a nucleo that has that mcu on it and start to build a prototype.
09:11 AM nohit: it costs like 10 bucks
09:15 AM nohit: if its wearable, maybe STM32L1 or STM32L4 series
09:15 AM nohit: L4 is more powerful
09:16 AM nohit: https://www.st.com/en/microcontrollers-microprocessors/stm32l4-series.html
09:17 AM nohit: that might be a little overkill tho
09:18 AM nohit: https://www.st.com/en/microcontrollers-microprocessors/stm32l0-series.html
09:23 AM nohit: i think something like this would be suitable for your project https://www.mouser.fi/datasheet/2/389/stm32l072v8-956310.pdf
09:23 AM nohit: https://www.mouser.fi/ProductDetail/STMicroelectronics/STM32L072RBT6?qs=sGAEpiMZZMuoKKEcg8mMKJrJMCR6OwdVdEunro5DigEqIJHl2MCdIw%3D%3D
09:35 AM ville: L is low-power units right? it'll draw power over the usb from a desktop machine so power is not really a concern
09:35 AM nohit: ok i though it was a portable device
09:35 AM nohit: yes l is for low power
09:36 AM ville: the device it self will be clipped on my headphones. but i'll use it with a desktop computer
09:36 AM nohit: yeah i get it now
09:37 AM ville: so i was guessing https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/stm32-mcu-mpu-eval-tools/stm32-nucleo-boards/nucleo-f031k6.html or https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/stm32-mcu-mpu-eval-tools/stm32-nucleo-boards/nucleo-f042k6.html would be ok
09:38 AM nohit: sure, i actually have that f042k6 nucleo
09:42 AM nohit: that only has 32kb of flash tho
09:42 AM nohit: i would still go with the L0 series
09:42 AM nohit: more flash
01:54 PM rue_mohr: nohit, using arduino hardware works, just dont get one with the freaking usb built into the microcontroller
05:41 PM rue_shop3: --
11:18 PM day_ is now known as day
11:21 PM bsdnub: hello my friends!
11:56 PM rue_mohr: hey