#avr | Logs for 2016-04-05

Back
[00:11:29] <Casper> one day I need to figure out how to set my router for ipv6
[00:11:41] <Casper> ... wrong channel
[00:50:48] <stephe> LeoNerd: yup, the v2
[02:19:22] <lorenzo> https://github.com/lcafaro/avr-sht2x
[02:19:24] <lorenzo> aaaand it's done
[02:46:22] <martinus> Cool, I don't use these sensors but the code looks nice and clean. Always like reading over stuff like this.
[03:12:25] <lorenzo> martinus: thanks :)
[07:00:05] <megal0maniac> LeoNerd stephe I have the v1 pololu programmer. It's really nice
[07:00:32] <LeoNerd> megal0maniac: mine just arrived today. I was just reading about the v2
[07:01:15] <LeoNerd> The v2 has a Linux-based control program; do you know of one for v1?
[07:01:26] <LeoNerd> To configure the A and B pins
[07:01:58] <megal0maniac> I'm afraid I never used it in Linux
[07:02:07] <megal0maniac> And now I use the jtagice3
[07:02:53] <LeoNerd> Hmm OK
[07:03:47] <twnqx> megal0maniac: does the ice also support avr32 and their SAMs?
[07:04:30] <megal0maniac> twnqx: Yip
[07:04:40] <megal0maniac> LeoNerd: "The configuration utility is written for Windows; there is no Linux version. All of the parameters that can be set in the configuration utility are stored in persistent memory, so Linux users only have to use Windows when they want to change those parameters, which should not be too often"
[07:04:49] <megal0maniac> "If you would like to write a configuration utility or SLO-scope application for Linux, you can contact us for information."
[07:05:38] <megal0maniac> twnqx: I know it works on the one AVR32 I have, as well as the SAM D20/21
[07:07:58] <LeoNerd> megal0maniac: Yah; I might ask them about it
[07:24:59] <Haohmaru> i know this isn't the right place, but does anyone happen to know if it's possible to make a modem module ignore a line of text? i mean a GSM-type module with AT commands
[07:25:25] <LeoNerd> There might be some sort of comment character
[07:25:54] <Haohmaru> i don't have a spare USART and want to print debug lines of text without this causing the module to spit fire at me
[07:26:18] <Haohmaru> i was hoping so too, but so far i'm unable to find anything
[07:26:34] <Haohmaru> google is especially useless with those kind of search terms x_x
[07:26:44] <LeoNerd> Yah.. :/
[07:27:10] <LeoNerd> If it's just output, you could soft-serial bitbang on a GPIO
[07:27:12] <Haohmaru> i know it has recognizes the backspace only
[07:27:37] <LeoNerd> If you're reading it on a logic analyser rather than a serial device directly, the bitrate doesn't even have to be anything specific.. you can tune it after-the-fact
[07:28:14] <Haohmaru> thing is.. i am running out of RAM too, bitbanging is not an option
[07:29:37] <Haohmaru> this all turned into sh*t.. doing it on a pic18f14k22, which has 512bytes of RAM.. i reduced the size of the FIFOs beyond silly already
[07:29:44] <LeoNerd> Prettysure you could bitbang UART TX'ing without needing any more RAM. It should fit in registers
[07:30:18] <Haohmaru> yeah, maybe.. i will still have to block tho
[07:30:23] <Haohmaru> so it'll get in the way
[07:30:48] <Haohmaru> it'd be much simpler if i could print on the UART since i already use printf() there
[07:33:42] <theBear> if igor can bang out usb, including soft differential compliments, maybe 10 years ago now, you can bang the hell outta some at commands !
[07:34:00] <theBear> bang 'em till they walk like a cowboy and can't sit right for a week !
[07:35:53] <theBear> find an old mobo or serial card, throw a real uart on that sucker ! jam some data up that clacker parallell 1xASM per byte styles, boiiiiiiii
[07:36:07] <Tom_itx> ooo kinky
[07:37:45] <theBear> i was thinking a bit gangstah, but eitehr way, at first i was like <insert image> then i like, really serious'ed the heck right up, no doubt.
[07:37:59] <theBear> i mean, that
[07:38:18] <theBear> 's how the big boys move their serial payloads this way and that, and those guys can't afford mistakes !
[07:51:42] <Haohmaru> well.. the backspace thing would work.. but it kinda sux
[07:52:25] <Haohmaru> i have to send as many backspace symbols as needed to fully erase the text i want to ignore before sending a newline
[07:52:27] <Haohmaru> mehz
[07:53:01] <Haohmaru> stupid AT command crap, i hate it
[07:53:18] <Haohmaru> ATFUUUUUUU
[07:57:14] <theBear> pfft, you obviously don't come from a time when it was an essential step in the connecting to computers outside of the room you were sitting in at the time process, a golden era when trolls were simple folk, getting excited if they fooled some monkey into typing 3 plus signs and then ath, telling their own modem to hang up on them instantly (which i gotta admit, did make me giggle everytime i saw it, but
[07:57:14] <theBear> that's not really the point <grin>)
[07:59:09] <Haohmaru> i know that time
[07:59:36] <Haohmaru> i was sending +++ATH0 packets to others >:)
[08:00:32] <Haohmaru> but it's uber stupid that the GSM sends a "\r\n> " when i send an SMS
[08:01:07] <Haohmaru> and it's kinda silly if there's no command to ignore the following line of text
[08:14:05] <theBear> pfft, it's over stupid your terminal doesn't read sensible old escape code linefeeds ;-)
[08:54:45] <Haohmaru> is some irc server connected via a modem here? dafuq >:)
[08:55:01] <LeoNerd> Wouldn't surprise me
[08:55:32] <Haohmaru> and i said the bad word ;P~
[09:07:28] <theBear> pfft modem can't disconnect and reconnect that many that fast
[09:07:47] <theBear> unless it's some kinda jacked-up liquid-cooled super-modem !
[09:07:54] <theBear> my god ! i didn't think we had the technology yet
[09:11:17] <WormFood> I'm using liquid nitrogen to cool my modem, to obtain more speed out of it.
[09:11:44] <WormFood> I have it up to six bits per second now.
[09:35:57] <Haohmaru> faster than herd of snails
[12:41:10] <liwakura> weird question.
[12:41:38] <liwakura> how should i proceed if i want to burn the debug symbols of my program to the progmem/flash?
[12:42:33] <LeoNerd> Probably want to start by finding a (or defining your own) format for how to represent that
[12:43:03] <liwakura> uint16_t + null-terminated char?
[12:43:13] <liwakura> in a row for each symbol
[12:43:14] <LeoNerd> Well you need more than that surely
[12:43:28] <LeoNerd> Typically you associate names with addresses
[12:43:36] <LeoNerd> Oh. I see, the integer is the address
[12:43:38] <liwakura> thats what the uint16 is for
[12:43:42] <liwakura> maybe also add the length
[12:44:00] <liwakura> i would make two sections for each the bss and the progmem
[12:44:14] <liwakura> maybe just ignore the bss stuff
[15:06:11] <jancoow> hi there
[15:06:28] <jancoow> is is possible to control neopixels from a avr chip with the internal timer/pwm ?
[15:08:55] <LeoNerd> They're selfcontrolled
[15:09:04] <LeoNerd> (you mean the WS2812s)
[15:13:57] <jancoow> yes
[15:14:10] <jancoow> do you think it's hard to write a programm for these one?
[15:14:36] <jancoow> i've got some laying around and they are easy to control with a librarie on rpi / arduino. But i wanna know how these things works so i wanna try it on a atmega128
[15:14:53] <LeoNerd> I've written them before. They're all over the internet
[15:15:02] <LeoNerd> Probably one of the most easily found of AVR things
[15:15:42] <jancoow> and did you make use of the internal timer/pwm ?
[15:15:45] <LeoNerd> No need
[15:15:54] <LeoNerd> You just write the data stream to the LEDs and they PWM themselves
[15:16:50] <jancoow> yeah i get that!
[15:16:52] <jancoow> but i mean
[15:16:57] <jancoow> to write the datastream
[15:17:31] <LeoNerd> Hellno.. that's waaaaaay too slow
[15:17:39] <LeoNerd> You want per-cycle timing to write that
[15:17:45] <LeoNerd> Typically people do that with a little ASM block
[15:18:44] <jancoow> i'm a little bit newbi to avr microcontrollers
[15:23:20] <jancoow> so okay; if i use a timer interupt which is clocked at 0.5 us for example
[15:23:45] <jancoow> and i use some kind of counter to know how long my T0 bit is low or high?
[15:23:52] <jancoow> could that work?
[15:25:20] <LeoNerd> That won't work. The data rate is a *lot* faster than that
[15:25:28] <LeoNerd> Really, just go find some existing code to do this
[15:25:36] <LeoNerd> There's many around
[15:26:03] <LeoNerd> 0.5us is 2MHz. If you clock the CPU at 16MHz that's a mere 8 instructions.
[15:28:19] <jancoow> ah
[15:28:25] <jancoow> okay well i will use a library then :)
[15:28:36] <jancoow> protocol is really complicated
[15:28:47] <LeoNerd> No it isn't ;)
[15:29:20] <LeoNerd> Reset is a long low pulse, then send a 24bit bitstream per LED using long and short pulses for 0s and 1s
[15:31:00] <jancoow> so, you actually send 24bit per led?
[15:31:20] <LeoNerd> Yes. As it says
[15:31:28] <LeoNerd> But really, just go find some existing code and read that
[15:31:30] <jancoow> and what is defined in her? 3 values for R G B and adress ?
[15:31:33] * LeoNerd has said 3 times now
[15:31:46] <jancoow> yeah i found existing code but just wanna hear your explanation :)
[15:32:13] <LeoNerd> I'm busy
[15:33:27] <jancoow> awh :(
[15:41:35] <liwakura> hm
[15:41:52] <liwakura> i have an interrupt that needs to check a bitfield
[15:41:55] <liwakura> quite frequently
[15:42:41] <liwakura> and now i want to put that into the GPIOR0 io register so i can use the bitset instructions
[15:43:02] <liwakura> how do i bind a c variable to be stored in a specific io field?
[15:43:34] <LeoNerd> I just #define it
[15:44:29] <liwakura> oh god
[15:44:35] <liwakura> #define varname GPIOR0
[15:44:38] <liwakura> seems to do it
[15:44:39] <LeoNerd> Yah ;)
[15:44:47] <LeoNerd> It's not terribly pretty but it works
[15:44:54] <liwakura> im so offended by this
[15:47:06] <liwakura> is this normal that interrupt routines have like 20 push before and like 20 pop instructions after?
[15:48:47] <LeoNerd> Yeah.. if gcc writes them
[15:48:52] <LeoNerd> It's not very good at realising that
[15:49:39] <liwakura> they are dependent if those registers are used in the rest of the code
[15:49:56] <jancoow> LeoNerd: ugh, i though i found a library but this one wouldn't even compile; errors everywhere. Do you have a librarie for the atmega128?
[15:50:19] <LeoNerd> Which one do you have?
[15:50:20] <liwakura> the GPIOR trick reduced my code from 0xb4 to 0xa8 instructions. i guess still too long for an interrupt
[15:50:32] <jancoow> LeoNerd: ws2812B
[15:51:15] <liwakura> i just i had such led's, i'd love to write a driver for them
[15:51:26] <LeoNerd> I use the light_ws2812 one
[15:51:38] <jancoow> mm i tried this one
[15:51:42] <jancoow> but i get compiler warnings -.-"
[15:51:58] <LeoNerd> So rather than fix it you gave up at the first chance?
[15:52:31] <jancoow> not really
[15:52:43] <twnqx> as if it's any difficult
[15:53:19] <jancoow> i'm trying to fix it ofcourse
[15:54:07] <LeoNerd> https://github.com/cpldcpu/light_ws2812 is the one I use
[15:54:17] <LeoNerd> Well, used up until I wrote my other one. ;)
[15:56:12] <jancoow> yeah exactly the one i'm trying to let it compile
[15:56:55] <LeoNerd> Hrm.. what's the going rate of a mega328P-AU (the QFP32 packaged one) these days? I see 5 for £4.40 on eBay.
[15:57:05] <LeoNerd> That feels a biiiit high
[15:57:07] <jancoow> error: 'asm' undeclared
[15:57:11] <jancoow> like wut lawl
[15:57:34] <LeoNerd> Er.. that soudns like you're doing something very strange
[15:57:44] <LeoNerd> How are you building it?
[15:58:14] <jancoow> short version: with a makefile ?
[15:58:54] <jancoow> with avr-gcc
[16:02:29] <jancoow> apperently a specific mode in my makefile which didn't allowed me to use ASM
[16:03:08] <LeoNerd> Sounds plausible. If you'd shown us more detail we might have found that
[16:03:17] <PoppaVic> offended
[16:03:45] <jancoow> yeah sorry, my bad. Sometimes when something doesn't work i'm asking to much questions in chat like these wihtout searching for a solution first by myself
[16:06:30] <jancoow> Great. The librarie works!!:) thanks.
[16:06:42] <LeoNerd> :)
[16:06:54] <edwardoid> Hi all
[16:07:14] <edwardoid> guys I can't properly initialize USART for Atmega328p
[16:07:28] <edwardoid> i think problem is in baudrate calculation
[16:07:32] <edwardoid> anyone can help me?
[16:07:49] <jancoow> sure
[16:07:59] <edwardoid> here is my formula: #define CALC_BRR(rate) (((F_CPU >> 4) / rate) - 1)
[16:08:00] <jancoow> how are you calculation it now?
[16:08:21] <LeoNerd> #define BAUD2UBRR(baud) (F_CPU/16/baud - 1)
[16:08:23] <LeoNerd> is what I use
[16:08:30] <jancoow> just what i wanna say
[16:08:35] <jancoow> i use the same formula as leonerd
[16:09:02] <LeoNerd> Which doesn't apply to 2X mode don't forget
[16:09:46] <edwardoid> let me try your formula
[16:09:56] <LeoNerd> Should be equivalent
[16:10:51] <edwardoid> yup
[16:11:06] <edwardoid> same result instead of 9600 its running on 300
[16:11:49] <LeoNerd> You sure your clock is running correctly?
[16:11:58] <LeoNerd> I'm forever typoing my F_CPU
[16:11:59] <edwardoid> i'm running atmega with crystal 16 mhz, and defined F_CPU=16000000L
[16:12:22] <LeoNerd> DIV8 fuse?
[16:13:00] <LeoNerd> You seem to be running 32 times too slowly. So probably not DIV8
[16:14:00] <edwardoid> avrdude -c usbasp -p m328p -C ../etc/avrdude.conf -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0x05:m
[16:14:43] <LeoNerd> Have you changed the clock prescaler?
[16:15:13] <edwardoid> no, I didn't changes anything, just runned this command to set fuses
[16:15:26] <edwardoid> can you show me your fuses settings?
[16:15:27] <LeoNerd> I mean, in the code.
[16:16:03] <edwardoid> I want to run my avr on 16Mhz, and I don't ned any bootloader, I'm not doing arduino clon or smthng like that
[16:16:09] <LeoNerd> lfuse of 0xFF sounds suspect
[16:17:44] <LeoNerd> Hm. though probably OK
[16:18:03] <LeoNerd> ext crystal 8MHz upwards; 16K SUT
[16:19:54] <edwardoid> can you advice me a better fuses config to run an AVR @ 16Mhz, without any bootloader?
[16:20:12] <LeoNerd> That's likely fine
[16:20:25] <LeoNerd> I'm just immediately suspiscious of all-zeroes or all-ones :)
[16:20:31] <LeoNerd> But looking it up, it seems OK
[16:22:41] <edwardoid> ....
[16:27:42] <edwardoid> I can shouw your code details if you need
[16:27:53] <jancoow> LeoNerd: well ty for helping! :) Only need to write a intrupt bases uart receive and then my wireless dj mixer is a go ;p
[16:28:03] <jancoow> http://jancokock.me/f/0f32d/ for the result btw
[16:28:14] <jancoow> wrong..
[16:28:23] <jancoow> this one https://jancokock.me/f/46ca4
[16:30:42] <LeoNerd> jancoow: Hah.. yah; don't forget that interrupts are disabled during writing to the WS2812 chain
[16:30:49] <LeoNerd> That was the trouble I had with my DMX receiver
[16:31:01] <jancoow> oh nice, you created a dmx receiver?
[16:31:07] <jancoow> that really cool!!
[16:31:14] <LeoNerd> Yah
[16:31:30] <jancoow> rs485 right?
[16:31:39] <LeoNerd> RS-485 at 250kHz yes
[16:32:07] <jancoow> cool. I created once a dmx controller with a rpi
[16:32:26] <jancoow> but beside that; you say it isn't possible to use uart interupts for example with this library?
[16:34:01] <LeoNerd> Indeed not, because that upsets the timing of the bit writes
[16:34:08] <LeoNerd> It's one reason I hate WS2812s
[16:34:25] <LeoNerd> I'd really suggest using APA-102s if at all possible. They're much nicer. They're an SPI-like chain, so immune from such timing problems
[16:35:09] <jancoow> doesn't have them laying around. My school assaigment is to use the esp2688 and we though it's cool for a wireless VU meter
[16:35:40] <jancoow> but this really makes it difficult to AND listen for new udp data in a interupt handler AND control these leds
[16:36:13] <LeoNerd> Yup
[16:36:19] <LeoNerd> Various solutions to that
[16:36:45] <LeoNerd> 1) write an update quickly with interrupts off adn hope that you can service it "later". Most IO peripherals with their own internal buffers should be OKwith that.. e.g. nRF radio modules
[16:37:22] <LeoNerd> 2) offload the WS2812 onto its own chip and talk to that via something else. I keep meaning to write a generic WS2812 offload chip on.. probably a tiny85 or such
[16:37:26] <jancoow> (i believed the uart in the atmega128 has a 1 byte buffer for 1 character)
[16:37:47] <LeoNerd> 1 character, yes.
[16:38:14] <LeoNerd> So probably not enough, unless your serial baud rate is really slow and/or you're not driving many LEDs
[16:38:26] <LeoNerd> I had 90 LEDs and 250kBaud serial, so that won't fly with me :)
[16:38:50] <jancoow> well we already have had problems with polling with a baudrate of 9600
[16:38:56] <jancoow> wow!
[16:39:01] <jancoow> that's really.. fast!
[16:39:11] <LeoNerd> That's DMX-512
[16:39:17] <jancoow> yeah
[16:39:20] <jancoow> and dmx is FAST :D
[16:50:50] <jancoow> but what i don't get
[16:51:01] <jancoow> why does neopixels work "very" good on a raspberry pi?
[16:51:10] <jancoow> i mean; raspberry pi has a lot of intrupts
[16:51:17] <jancoow> (multithreading)
[17:04:43] <learath> it's also running at 1 gigglehurts
[17:04:48] <learath> vs 16 megahurtz
[17:06:49] <jancoow> true that
[17:07:22] <jancoow> but hey; i managed to let a quadcopter fly with a rpi! ;p
[17:11:34] <edwardoid> Fixed!
[18:33:56] <edwardoid> Does anyone have nrf24l01 and atmega 8a/328p?
[18:34:57] <edwardoid> Or maybe rc-522 and atmega 8/328p?
[18:38:10] <Lambda_Aurigae> no atmega328
[18:38:18] <Lambda_Aurigae> have an atmega8 and atmega88
[18:38:26] <Lambda_Aurigae> but never used either with the nrf chips.
[18:38:34] <Lambda_Aurigae> never used rc-522
[18:38:36] <LeoNerd> I use nRF24L01 w/ 328P
[18:38:39] <LeoNerd> (and also tiny84)
[18:41:09] <edwardoid> I'm working on a lib for avrs, my nrf-s seems does not work properly, so I need someone to test this part of my lib
[18:41:27] <edwardoid> Do you have enough time to do that?
[18:41:29] <LeoNerd> I could show you my code and you could compare
[18:41:48] <LeoNerd> I'm about to head to bed actually, but I can leave you mine to read
[18:43:16] <edwardoid> We talk later. I've already compared my code with other implementations, seems my implementation is okay and should work
[18:43:39] <edwardoid> I just want to test it on real device
[18:44:06] <edwardoid> I've already ordered new chips, but need to wait 30+ days
[18:44:16] <edwardoid> That's why I'm asking for help
[18:44:49] <edwardoid> If you're busy or something like that... It will be okay
[18:45:11] <edwardoid> :)
[18:45:21] <LeoNerd> Well, if "going to bed because it's gone midnight" counts as busy.. ;)
[18:45:35] <LeoNerd> I just spent the last 90 minutes manually rerouting an entire PCB
[18:45:36] <edwardoid> Lol :) okay
[18:45:52] <edwardoid> Red-eye guy
[18:46:18] <edwardoid> Good night!