#avr Logs

Mar 12 2017

#avr Calendar

12:02 AM homa_: Casper: what is it best company for programmer
12:04 AM _ami_: homa_: just buy a usbasp programmer for aliexpress..
12:05 AM _ami_: although i bough a usbasp from local vendor.. https://www.robomart.com/avr-usb-programmer-usbasp?search=usbasp&dsearch=usbasp
12:05 AM _ami_: bought*
12:06 AM homa_: _ami_: my device is fake
12:06 AM homa_: ?
12:06 AM _ami_: do you have arduino uno with you?
12:06 AM _ami_: you could re-program your atmega8 using arduino (ISP sketch)
12:06 AM homa_: i don't have
12:08 AM homa_: sketches
12:24 AM Casper: homa_: or support a fellow #avr user: tom_itx/Tom_L
12:42 AM _ami_: yeah, you could buy from Tom_L
12:52 AM homa_: _ami_: what is this ?
01:00 AM _ami_: http://tom-itx.no-ip.biz:81/~webpage/index.php
08:29 AM julius: hi
08:30 AM julius: i am sure that i used this exact command: avrdude -v -p atmega328p -c arduino -P /dev/ttyUSB0 -b 115200 -D -U flash:w:simple2.hex:i to program a arduino uno just yesterday...but today avrdude keeps timing out...any idea what could cause this?
08:36 AM gamelaster: julius: you are sure the /dev/ttyUSB0 is active?
08:37 AM julius: active in what way?
08:37 AM julius: i got: [521750.110109] usb 1-4: ch341-uart converter now attached to ttyUSB0 in dmesg and crw-rw---- 1 root dialout 188, 0 Mär 12 14:07 /dev/ttyUSB0
08:38 AM julius: the arduino is even running the program from yesterday, receiving via a bluetooth module and blinking a led when "h" is send
08:38 AM gamelaster: and AVRdude still keeps timing out?
08:38 AM julius: yeah
08:39 AM julius: the LED marked with L blinks a few times fast on the board
08:39 AM julius: but nothing else happens
08:40 AM gamelaster: that's weird
08:41 AM gamelaster: dumb question, but did you tried another USB port?
08:42 AM Emil: why use -D?
08:44 AM julius: as it turns out if i disconnect TX to the bluetooth module it works
08:45 AM julius: just found that answer on the arduino forums
08:45 AM julius: gamelaster, yes i did :)
08:45 AM Emil: pls
08:46 AM Emil: obviously you cant have the bt on at the same time :D
09:35 AM _ami_: is it possible to implement OTG on stm32f103 board?
09:37 AM Lambda_Aurigae: does the chip support it?
09:41 AM _ami_: : i can see a main-stm32f103-generic.c file in tests/@libopencm3 folder where it seems that OTG code is there.
09:41 AM Lambda_Aurigae: that's not what I asked.
09:41 AM _ami_: https://github.com/libopencm3/libopencm3/blob/master/tests/gadget-zero/main-stm32f103-generic.c
09:42 AM Lambda_Aurigae: have you read the datasheet for the particular chip you have on your board to see if it is supported?
09:44 AM _ami_: well.. DS does not say abt OTG
09:44 AM _ami_: seems like dtm32f4 supports otg1
09:45 AM _ami_: otg!*
09:48 AM Lambda_Aurigae: seems the stm32f103 series does not support OTG.
09:49 AM Lambda_Aurigae: I see one reference to something OTGFS which might not be the same as usbOTG.
09:50 AM Lambda_Aurigae: in your link for the generic.c
09:53 AM _ami_: Lambda_Aurigae: RCT6 has OTG
10:01 AM _ami_: Lambda_Aurigae: http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f105-107/stm32f105rc.html f105rc has OTG!
10:01 AM _ami_: not the 103 series IMO
10:01 AM Lambda_Aurigae: yes
10:01 AM Lambda_Aurigae: the 103 series does not support it.
10:01 AM Lambda_Aurigae: that's what I said.
10:02 AM _ami_: indeed!
10:30 AM _ami_: Lambda_Aurigae: even libopencm3 does not support OTG :P
10:30 AM _ami_: you were right.. thats something else.
10:30 AM _ami_: USB_OTG
10:31 AM _ami_: https://github.com/insane-adding-machines/unicore-mx seems to support otg
10:31 AM _ami_: although its pretty new
10:31 AM _ami_: its FORK of libopencm3
12:36 PM Tachyon` is now known as Tachaway
01:08 PM BusError: grphs... whats the printf format for uint32_t in hex? tried %lux %ux etc etc in every combinations
01:12 PM Ad0: %d
01:12 PM Ad0: %zu
01:13 PM Ad0: that's size_t heh
01:13 PM Ad0: tou tried %u ?
01:13 PM BusError: yeah, that's decimal
01:14 PM Ad0: http://alvinalexander.com/programming/printf-format-cheat-sheet
01:16 PM BusError: hmm been programming in C for the better part of 30 years, I do have a vague idea how to use printf ;-)
01:18 PM julius: hi
01:18 PM polprog: o/
01:19 PM julius: reading a adc tutorial, it says to include: #include <avr/dtostrf.h> but that file is not in avr-libc on debian...where can i get it?
01:19 PM polprog: there's no need of any library to use the adc
01:19 PM julius: rihgt
01:20 PM polprog: can you link that tut?
01:20 PM julius: i meant for converting from double to string
01:20 PM julius: double to char i mean
01:20 PM cehteh: why double?
01:20 PM cehteh: NO FLOATS !
01:20 PM cehteh: adc gives you a 10 bit integer
01:21 PM julius: ah ok
01:21 PM polprog: you are looking for itoa()
01:21 PM cehteh: with some tricks and oversampling you can comfotably extend that to a 16 bit int
01:21 PM julius: i want to output the value via my bluetooth module which reads a char as input in the send function
01:21 PM polprog: send two hars or divide the adc result by 4
01:22 PM polprog: the latter one looses resolution
01:22 PM polprog: two chars*
01:22 PM julius: ah ok
01:22 PM cehteh: first of all what resolution do you needhave
01:22 PM julius: one second
01:23 PM cehteh: itoa is somewhere in the avrlibs but ist not standard C
01:24 PM polprog: it's in stdlib.h
01:24 PM cehteh: you can use sprintf or sometihng lilke that
01:24 PM cehteh: yes
01:24 PM polprog: cehteh: why sprintf? it's more complicated
01:24 PM cehteh: yes
01:24 PM julius: that tutorial does say anything about resolution...let me google the settings
01:24 PM cehteh: just use itoa ..
01:25 PM cehteh: for my own stuff i implemented something like that by myself, its not that complicated to code
01:25 PM polprog: julius: the ADC resolution is 10 bit but you can use result>>2 to make it 8 bit and cast it
01:26 PM cehteh: i needed a interruptible itoa like function in case the buffer is full, which can later resume on the rest
01:27 PM cehteh: you can operate the ADC in 8 bit without shifting, there is a flag which left aligns the output and then one need to read only the high byte
01:27 PM cehteh: if thats good enough for you
01:27 PM cehteh: usually i feel that 10 bit is often already not enough and i prefer to scale it to 16bit
01:27 PM polprog: yeah, i forgot about that flag
01:28 PM polprog: how can you scale a 10 bit adc to 16 bits?
01:28 PM cehteh: oversampling/lowpass is simple to do
01:28 PM polprog: is it like averaging many samples or what
01:29 PM cehteh: yes, but you can easily do a rolling average
01:29 PM polprog: thx
01:30 PM cehteh: multiply the first valid (read datasheet, very first reads might be ill) by 64, store that
01:31 PM cehteh: then for each new adc read value -= value/64; value += ADC;
01:31 PM cehteh: and atmel has a even more elaborate appnote about proper oversampling .. which then need some more work
01:32 PM cehteh: but that above is good enough and simple that you almost always want to do thazt
01:32 PM cehteh: http://www.atmel.com/images/doc8003.pdf
01:33 PM polprog: thanks
01:34 PM cehteh: depends on what you are doing a RC filter on the ADC input might be also favorable
01:34 PM cehteh: http://tinyurl.com/onqagld .. having that in my bookmarks
01:42 PM julius: thanks for the input, need to figure out some other stuff
01:43 PM polprog: what's that?
01:44 PM polprog: that you need to figure out
02:27 PM julius: why the fuck does google send me to: http://www.nongnu.org/avr-libc/user-manual/group__avr__stdlib.html when googling for avr iot
02:27 PM julius: a
02:27 PM julius: its not present on that page
02:28 PM julius: oh, its itoa
02:35 PM julius: so i have my "unsigned int adc_value" to save the result from the adc conversion, since the adc converter returns a 2 bit integer can i convert it like this: char output[3]; itoa(adc_value, output, 10); 2 bytes being used for the data and one additionally to add a zero?
02:44 PM Smidge204: Just a quick Q about internal pullups to make sure I understand them right... with the proper DDB bit set to 1, the internal pullup will cause the input on the corresponding pin to be pulled high when you write a 1 to the output for that pin?
02:45 PM Smidge204: Otherwise the input pin will be floating without anything external to the device to stabilize it
02:46 PM kline_ is now known as kline
02:59 PM polprog: Smidge204: yes, if the DDRx is set to output then writing 1 to PORTx will enable the pullup
03:01 PM cehteh: set to input
03:05 PM Smidge204: Well, the clarification I guess is, the DDR bit ties the output register to the input register
04:24 PM Arlenx: hi there, i'm working on a little program to decode infrared NEC protocol but i have some problem when i try to decode the bits. here is my program: http://pastebin.com/NdtPhNiP the program work ok up until phase_3 so it's pass the 9ms and the 4.5ms but then i have problem with the decode.can someone help please?
10:21 PM LoRez: anybody playing with digisparks in here? I'm trying to figure out how to connect to it via usb with avrdude
10:34 PM LoRez: (on ubuntu)
10:46 PM Chillum: I have just played with the attiny85 itself
10:46 PM Chillum: are they using some kind of fancy bootloader to emulate USB serial?
10:47 PM Chillum: can they even be programmed over USB? I thought the D- and D+ pins were just GPIO with 3.3V clamping diodes
10:48 PM Chillum: I thought they has to be programmed over 6-pin ISP
10:57 PM LoRez: well, damn. micronucleus does some weird shit.
11:26 PM _ami_: LoRez: its really very tight code!
11:35 PM LoRez: apparently. Custom programming computer side code to compensate even.