#avr | Logs for 2015-08-29

Back
[06:36:52] <Emil_> Hi
[06:36:57] <Emil_> I have a problem with the dfu bootloader
[06:37:06] <Emil_> I downloaded the hex files from atmel
[06:37:23] <Emil_> but the bootloader doesn't seem to work
[06:37:48] <Emil_> I installed the dfu-programmer
[06:38:03] <Emil_> but lsusb doesn't show the spesfic model
[06:40:26] <Emil_> just that there's an atmel producrt
[06:40:37] <Emil_> dmesg tells me that it indeed is ATM32U4DFU
[06:40:42] <Emil_> but that's not a valid target for it
[07:32:51] <metRo_> if I measure on clockout 15.999MHz using a logic analyser or 16.001Mhz on a multimeter, it is ok?
[07:33:03] <metRo_> I;m using a 16mhz clock
[07:49:25] <metRo_> do you think that read 15.999Mhz or 16.001Mhz is sufficient to uart errors at 115200?
[08:01:17] <devilsadvocate> metRo_: your measurement devices are unlikely to be accurate enough for a measurement at that resultion
[08:01:29] <devilsadvocate> metRo_: and yes, it's enough
[08:02:40] <devilsadvocate> 50-100 ppm is what you usually expect with the usual decent quaility crystals
[08:16:32] <metRo_> devilsadvocate: by error I mean 100%
[08:16:38] <metRo_> not one byte in 100
[08:16:42] <metRo_> all bytes wrong
[08:17:43] <devilsadvocate> metRo_: 15.999 - 16.001 is enough to get pretty much all bytes correctly.
[08:18:09] <metRo_> i'm getting all bytes wrong
[08:18:10] <metRo_> :s
[08:18:23] <Lambda_Aurigae> metRo_, you are going to need to put an oscilloscope on the usart lines and see what's happening I bet.
[08:18:34] <Lambda_Aurigae> or, adjust your UBRR settings a little.
[08:18:46] <devilsadvocate> by pretty much I mean all other than any intrinsic mismatch in the multiplers, whatever is listed in the datasheet.
[08:34:27] <metRo_> change atmega for another from other batch
[08:34:30] <metRo_> and the same result
[08:34:32] <metRo_> :s
[08:34:53] <metRo_> so the problem isnt with the atmega
[08:37:44] <Lambda_Aurigae> as I said, you need to look at the signal and measure it.
[08:38:13] <Lambda_Aurigae> a good protocol analyzer can capture and analyze it and tell you what is wrong too.
[08:39:00] <metRo_> logic analyser said it is 125000
[08:39:07] <metRo_> baudrate and not 115200
[08:39:27] <Lambda_Aurigae> then adjust the UBRR to fit.
[08:40:57] <metRo_> Lambda_Aurigae: http://i.imgur.com/lncrKxY.png
[08:41:07] <metRo_> http://i.imgur.com/6uJ1O0N.png
[08:41:34] <metRo_> Lambda_Aurigae: why this happen if my clock looks so good
[08:41:53] <metRo_> devilsadvocate: can you take a look at logic analyser scans?
[08:41:54] <Lambda_Aurigae> without seeing your code and schematic, I have no way of knowing.
[08:42:13] <Lambda_Aurigae> your clock is at 16MHz, what is your UBRR set to?
[08:42:41] <metRo_> Lambda_Aurigae: http://pastebin.com/dWJc8i37
[08:43:11] <Lambda_Aurigae> I asked for a number.
[08:43:16] <Lambda_Aurigae> not your code so I can do the math.
[08:43:36] <metRo_> Lambda_Aurigae: i was posting that because you asked for the code
[08:43:41] <metRo_> not to answer you
[08:43:45] <metRo_> and the schematic http://i.imgur.com/MT9Slep.png
[08:45:09] <Lambda_Aurigae> set UBRRH to 0 and UBRRL to 8
[08:45:12] <Lambda_Aurigae> and see what happens.
[08:45:24] <Lambda_Aurigae> because by the math that I'm doing it comes out as 7 by your source.
[08:47:01] <Lambda_Aurigae> I'm guessing the "-1" in line 6 is screwing it up.
[08:48:00] <Lambda_Aurigae> http://wormfood.net/avrbaudcalc.php?postbitrate=115200&postclock=16&hidetables=1
[08:48:38] <Lambda_Aurigae> if you can run the atmega328 in double speed mode you can get closer.
[08:48:43] <metRo_> logic analyser said it is 111111 now and the terminal can correctly read the value
[08:48:49] <Lambda_Aurigae> http://wormfood.net/avrbaudcalc.php?postbitrate=115200&postclock=16&u2xmode=1&hidetables=1
[08:53:30] <metRo_> Lambda_Aurigae: tahnk you for your help
[08:59:04] <Lambda_Aurigae> welcome
[08:59:19] <Lambda_Aurigae> if you had posted that days ago anybody else could have seen the same thing.
[08:59:32] <Lambda_Aurigae> in fact, someone did try to help you by pointing you at the calculator.
[09:01:04] <Lambda_Aurigae> and I see now where the error in your math is.
[09:01:11] <Lambda_Aurigae> the -1 is in the wrong place in the fomula.
[09:02:03] <Lambda_Aurigae> look at the usart section 18 where it talks about examples of baud rate setting.
[09:02:08] <Lambda_Aurigae> there is a formula in there.
[09:02:48] <Lambda_Aurigae> that is for calculating error%
[09:03:00] <Lambda_Aurigae> but I believe it is also where your formula is derived.
[09:04:47] <Lambda_Aurigae> I would suggest setting the unit to double speed and going with the double speed UBRR setting..it gets you a much lower error %
[09:46:35] <Emil_> Hi!
[09:46:52] <Emil_> Do any of you have quick commands to flash the dfu bootloader
[09:47:00] <Emil_> and then flash the chip using the dfu
[09:47:07] <Emil_> Because it's not working for me
[09:48:29] <Emil_> First I flashed the dfu bootloader: sudo avrdude -p m32u4 -c usbasp -e -U flash:w:ATMega32U4-usbdevice_dfu-1_0_0.hex:i
[09:48:54] <Emil_> I also used the fuses -U lfuse:w:0xce:m -U hfuse:w:0x99:m -U efuse:w:0xc3:m
[09:48:59] <Emil_> with that command
[09:49:10] <Emil_> anyways, after this lsusb shows that there is an atmel device
[09:49:26] <Emil_> and dmesg correctly shows that the product is indeed atmega32u4
[09:52:34] <Emil_> but uploading: sudo avrdude -p m32u4 -c flip1 -e -U flash:w:test.hex:i
[09:52:36] <Emil_> does nothing
[09:52:39] <Emil_> Oh, sorry
[09:52:46] <Emil_> It does complete
[09:52:49] <Emil_> but the chip does nothing
[09:54:40] <Emil_> So
[09:54:53] <Emil_> if you have commands that you use to flash whatever you want to the chip
[09:55:00] <Emil_> and the commands to flash the firmware
[09:55:08] <Emil_> I'd be very, very grateful
[09:55:17] <Tom_itx> set your fuses to boot from the bootloader section
[09:56:14] <Emil_> Tom_itx: which fuse is that?
[09:56:31] <Emil_> I have been looking at a fuse calculator but so far I have failed
[10:02:58] <Tom_itx> boot section fuses
[10:06:27] <Emil_> Tom_itx: could you help? I have been banging my head for literally 3 hours
[10:09:01] <Emil_> One error I get is Error: "lfuse" memory not accessible using FLIP
[11:11:14] <Lambda_Aurigae> Emil_, you can't set fuses with flip or dfu.
[11:11:25] <Lambda_Aurigae> you have to use jtag or spi or pdi or whatever your chip uses.
[11:11:35] <Lambda_Aurigae> spi/isp
[12:33:17] <Emil_> Lambda_Aurigae: so
[12:33:20] <Emil_> what syntax can I use, then?
[12:33:54] <Lambda_Aurigae> what programmer hardware do you use?
[17:46:03] <maena> I'm using an ATmega32u4 for a keyboard, currently all the scancodes it outputs over USB is hardcoded in the firmware, but I'd like to make it configurable (from the host OS, it'd send to the controller and it will store it, non-volatile ofcourse). Can I use the EEPROM for this?
[17:51:31] <Lambda_Aurigae> if you have to ask then no, you probably can not
[17:51:34] <Lambda_Aurigae> at least, not yet.
[17:51:40] <Lambda_Aurigae> do you have the source?
[17:56:39] <antto> if possible, store them in eeprom, but load them in ram for the actual usage
[17:57:36] <Lambda_Aurigae> hardest part is going to be sending the data from the PC to the unit in the first place.
[17:58:16] <Lambda_Aurigae> would have to either create a separate endpoint for cdc comms or setup something in a HID descriptor for 2-way comms.
[18:02:55] <maena> just been playing around with the Arduino HID example, but I plan on writing my own stuff, just would like to (in the final product) be able to customize the scancodes without having to flash a new firmware every time
[18:03:10] <Lambda_Aurigae> I have no clue on arduino stuff.
[18:05:16] <maena> It's basically C for newbies, so the syntax is the same. Here is an example of a 3-button HID device (volume keys) https://gist.github.com/mitchtech/2865200#file-usb_hid_volume-ino
[18:05:43] <Lambda_Aurigae> I know all about what the whole arduino thing is...I just avoid it like the plague it is.
[18:07:12] <Lambda_Aurigae> http://pastebin.com/dSRSxgax
[18:08:31] <maena> I know it's bloated, I'm just playing around with it as an introduction to AVR
[18:09:04] <Lambda_Aurigae> learn the bad habits first.
[18:09:58] <maena> also been testing this: https://github.com/tmk/tmk_keyboard