#avr | Logs for 2014-05-07

Back
[00:01:10] <clixxIO> Tom_itx: Do you have that macro for setting output pins?
[00:02:54] <clixxIO> I'm using the clunky method to flash an LED - https://github.com/clixx-io/clixx.io/blob/master/examples_attiny/tempreporter/tempreporter.cpp
[00:03:20] <clixxIO> PORTB |= (1<<D1_O);
[00:03:48] <clixxIO> if someone has an easier to read macro that would be great
[00:21:47] <inflex> lo there Tom_itx :)
[00:24:39] <inflex> What? what's clunky about that?
[00:25:04] <inflex> Macros can cause more trouble than not
[00:25:23] <clixxIO> really? how so?
[00:25:36] <clixxIO> for simple things
[00:26:13] <inflex> #define SQR(x) (x*x) ..... then you do foo = SQR(a+b); // wrong
[00:27:10] <inflex> Still, if you want a macro to do the port (output) setting, just try something like #define SETB(x) PORTB |=(1<<(x))
[00:27:37] <inflex> but I do warn you, macros will eventually make you tear your hair out when you're trying to find a bug that simply "doesn't make sense!"
[00:28:18] <clixxIO> I've lots of experience in those - I've used Microsoft's C++ compiler
[00:28:53] <clixxIO> well, not on AVR
[00:29:13] <clixxIO> GCC doesn't always prove to be better
[00:29:37] <inflex> gcc is more about portability than faster/more-optimised
[00:30:14] <inflex> Though the new clang compiler on the scene is really kicking up some dust
[00:32:29] <inflex> Anyhow, barring some extreme situations avr-gcc does a perfectly acceptable job
[02:52:23] <hetii> Hi :)
[02:52:42] <kaedrin> Hi
[02:55:07] <hetii> Q: On Atmega8 i use uart to comunicate with one device, but I also need just receive data from second one, booth work with the same settings. Is there any way to redirect from interrupt for second device data to the first uart ?
[02:55:39] <hetii> or maybe use some software implementation of uart ?
[03:16:12] <jadew> if you want to receive data from both, you can daisy chain them
[03:17:45] * jadew is off
[03:23:28] <hetii> Well i have just TX in one of device.
[04:33:11] <edmont> hi
[04:33:12] <edmont> how does "Modbus over SPI" sound to you?
[04:36:19] <jacekowski> whyyyyyyyyyyyyyyyyyyyyyyyyyyyy????????
[04:42:00] <edmont> jacekowski: chip to chip communicationes
[04:46:17] <Klapo> hello guys
[04:46:33] <Klapo> one question.. how can we make interrupt every 20ms using Atmega2560 and Atmega328 ? (AVR C)
[04:50:12] <jacekowski> Klapo: with a timer
[04:54:36] <angs> I use PD2 as an pin change interrupt (PCINT0) on atmega168a. Is it wrong to do if(PD2 == 0){ ...} on the code?
[05:00:28] <Yotson> read the application note from Atmel already Klapo?
[05:48:12] <clixxIO> I'm really not sure about one thing. Does the Attiny85 have some sort of UART or not?
[05:48:40] <clixxIO> Yes I'm using softuart at the moment, that's fine
[05:49:28] <clixxIO> I've never found any compilable code for accessing UART hardware on the Attiny85
[06:01:15] <RikusW> because there is none
[06:02:19] <clixxIO> that's good
[06:03:24] <clixxIO> Thanks for confirming that
[06:07:38] <clixxIO> I can keep writing more serial code in comfort then..
[06:37:31] <Lambda_Aurigae> doesn't the attiny85 have a USI? I thought those kinda did USART work.
[07:16:28] <angs> I use PD2 as an pin change interrupt (PCINT0) on atmega168a. Is it wrong to do if(PD2 == 0){ ...} on the code?
[07:20:58] <megal0maniac_afk> Doh.
[07:21:23] <megal0maniac_afk> I explained the lack of UART to clixxIO already
[07:25:02] <megal0maniac_afk> Even explained USI and linked him to the appnote for implementing UART with USI
[07:29:38] <hackvana> and?
[07:37:45] <jadew> Lambda_Aurigae, they do
[07:38:18] <jadew> angs, yes, it is
[07:38:24] <jadew> PD2 is 2
[07:38:28] <jadew> 2 != 0
[07:39:12] <jadew> you probably want: if ( PIND & (1 << PD2) ) { ... }
[07:39:25] <angs> jadew, thank you very much
[07:39:27] <jadew> np
[07:40:23] <hackvana> megal0maniac_afk: As you know I'm very familiar with clixxIO. What happened after you explained it to him?
[08:14:30] <malinus> any recommendation for schematic drawing software on linux?
[08:23:56] <megal0maniac_afk> hackvana: Was just expressing minor frustration :) One sec, looks like zlog was off sick that day...
[08:24:25] <hackvana> malinus: Hi
[08:24:52] <malinus> hackvana, hi :)
[08:24:56] <megal0maniac_afk> http://megal0maniac.dyndns.biz/2014-04-06.log
[08:24:57] <hackvana> megal0maniac_afk: He seems to enjoy taking the route of maximum pain so that others can see his pain
[08:25:29] <hackvana> malinus: There are several choices for schematic capture in Linux
[08:25:46] <malinus> I've been a windows user for years using eagle
[08:25:54] <megal0maniac_afk> hackvana: http://megal0maniac.dyndns.biz/2014-04-06.html rather, otherwise it downloads :/
[08:25:56] <hackvana> (disclaimer: I have a PCB supply business. see channel #hackvana)
[08:25:58] <malinus> but now I want something free as in freedum
[08:26:00] <megal0maniac_afk> Aw ff
[08:26:03] <hackvana> malinus: Good
[08:26:30] <hackvana> I was going to suggest Diptrace under Wine, and Eagle, just so I could get it over with
[08:26:41] <hackvana> Most of my freedom-loving customers use either gEDA or KiCad.
[08:26:45] <hackvana> (Me I use KiCad)
[08:27:17] <hackvana> Both are GPL and have no "feature" which limits functionality
[08:27:32] <hackvana> Both make very nice boards
[08:28:23] <hackvana> gEDA has more of a "unix tool" philosophy. You're expected to take the parts and work out how to put them together.
[08:28:40] <hackvana> I must admit, I found it a bit difficult to get started, and I gave up
[08:28:44] <megal0maniac_afk> Nevermind. Log it is. Anyway, Basically I told him there's no UART, which explained why Peter Fleury's library wouldn't compile for t85, then pointed him in the right direction to implement software UART using the USI which he "bookmarked for later use"
[08:29:02] <hackvana> You can also do software UARTs using the timer and pin sampling
[08:29:20] <megal0maniac_afk> hackvana: Yeah he's using some other library which does that for him
[08:29:37] <hackvana> Ahh
[08:29:37] <megal0maniac_afk> But he seems to have clean forgot about that conversation
[08:29:51] <hackvana> malinus: And then there's KiCad.
[08:29:53] <megal0maniac_afk> And regressed back to "I don't understand why I can't find the UART"
[08:30:02] <megal0maniac_afk> +1 for KiCad
[08:30:03] <malinus> hackvana, I'm trying our KiCad
[08:30:17] <hackvana> Which I feel is easier to get started with, but has two major problems
[08:30:26] <hackvana> The first is that the symbols and footprints it comes with are rubbish
[08:30:37] <hackvana> They look terrible, the selection is poor, and they are often wrong.
[08:30:53] <hackvana> Fortunately it's easy (even fun) to make your own. And you will.
[08:31:17] <hackvana> Second, so much work is going into KiCad at the moment, that it has a reputation as being unstable.
[08:31:54] <hackvana> I think it was stable half way through 2014 but since then, it's changing so fast that you might find problems
[08:32:21] <hackvana> If you want to talk about using KiCad, there's a channel for it (#kicad)
[08:32:34] <hackvana> You'll also find #hackvana useful, for talking about electronics, and about PCBs.
[08:32:45] <hackvana> Many people in here are in both.
[08:32:54] <hackvana> For example DrLuke
[08:33:08] <hackvana> And Honeyclaw
[08:33:53] <malinus> sure I keep that in mind, thanks
[08:34:36] <megal0maniac_afk> And me \o/
[08:34:48] <megal0maniac_afk> 'cept I can't help much with PCBs. Yet. :)
[08:35:20] <hackvana> Yeah megal0maniac_afk is also over there. You're welcome to join us.
[08:35:32] * megal0maniac_afk lurks
[08:35:40] <hackvana> There are experts in both gEDA and KiCad there.
[09:35:39] <malinus> this is more of a C question but I'll ask anyway. I have a few different variables, each is of different type (long, int, int and char). So a total of 9bytes or so. I need a pointer to a buffer containing all that data. What would be the cleanest approach?
[09:43:05] <timemage> malinus, kind of depends on what you're doing with that buffer. you can put them all into a struct if you want. but you probably shouldn't just use the structure layout as a wire protocol.
[09:43:29] <malinus> well I don't think I can use a structure, a pointer to a structure will probably have some overhead?
[09:43:53] <malinus> and not just alligned the data bit for bit
[09:44:06] <timemage> malinus, i wouldn't expect so for an 8bit microcontroller. there isn't any need for packing or aligning; not that i'm aware of anyway.
[09:45:15] <timemage> malinus, normally you'd align things for performance reasons, or because the databus can only access word aligned word accesses or whatever. your minimally addressable unit is your word on an avr.
[09:45:59] <malinus> timemage, okay, this might simply be a bad approach from my side, aka. a A->B problem. So let me explain what I want. I have around 4 different variables, of different data types, totaling 9bytes. I'm sending this with a NRF-transmitter unit, which sending functions takes a pointer to the start of the buffer.
[09:47:28] <malinus> timemage, am I being clear now?
[09:47:36] <timemage> malinus, hmm, well, C's memory model is such that there is essentially an array of unsigned char underlying everything (well in data).
[09:48:04] <Tomires> Hello, I am working on a school project and I need to add, substract and multiply two numbers from 8bit registers (R25, R26) and save the results inside the 16-bit pair register (R30+R31). Could you point me in the right direction? Thanks ^^
[09:48:17] <malinus> timemage, well I see, how do I ensure it's aligned though?
[09:48:56] <Tomires> (I am using AVR assembler)
[09:48:58] <timemage> malinus, with respect to C, they don't give guarantee of that. however, what i was getting at above is that there isn't any alignment to speak of in an avr.
[09:51:56] <malinus> timemage, so it's not possible?
[09:52:23] <timemage> malinus, no idea how you got that out of what i've said.
[09:52:48] <timemage> malinus, what is it that you think alignment is for?
[09:53:53] <malinus> timemage, to ensure that the data will be send in the order I hope for, and not random bytes after each other
[09:54:50] <timemage> malinus, the alignement of the data doen't have anything to do with ordering. that much is guaranteed by C.
[09:57:10] <malinus> timemage, could you get back to the possible solutions :)?
[09:57:56] <timemage> malinus, nah, i've gone in enough circles already.
[14:57:09] <malinus> why are small-ish (5"-10") screens so expensive?
[15:05:15] <myself> because you're not using cellphone screens
[15:05:34] <myself> make a driver for an iphone screen or something, the hobbyist world will beat a path to your door
[15:06:37] <malinus> any well-known smartphone screen would do
[15:06:55] <malinus> time to get started ;)
[15:09:16] <malinus> but yeah, you can buy those 320x240 2.3" touchscreen at the price of a cellphone screen
[15:09:27] <malinus> and the cellphone screens are normally like 5" HD
[15:09:44] <malinus> is there really not a market for hobby-screens?
[15:14:11] <Tom_itx> no
[15:14:17] <anic_> sure there is. all 23 of us.
[15:14:46] <Tom_itx> i got one from a minivan tv once if that may point you in a direction
[15:14:55] <Tom_itx> that's an app for one
[15:16:34] <malinus> Tom_itx, those are all (of the ones I've found) analog :V. How hard would it be to figure out how to drive some random notebook screen?
[15:20:42] <Daulity> well it would be better if there were a display driver for gameboy screens
[15:23:58] <malinus> Duality, why is that. The driver for the old nokia display is documented :)
[15:31:15] <Daulity> malinus: well i guess why is because gameboy screens are awesome ? :)
[15:31:24] <Daulity> and i have alot of them helps too
[15:33:32] <Daulity> woo awesome http://www.loirak.com/gameboy/gbatutor.php
[16:08:59] <hetii> Hi :)
[16:12:30] <hetii> I have different result from my uart then i expect: http://pastebin.com/CbnbKMGr
[16:12:35] <hetii> any clue why ?
[16:18:07] <malinus> Duality, hey - nokia screens are awesome too!
[16:24:14] <Daulity> malinus: hell yea they are :D
[16:26:13] <Daulity> hetii: what are you sending ?
[16:29:24] <hetii> I try get data from my rfid reader, when i use python console then i get them right, the hex value is: '\x01\x00\xc1\xb6\x13' but when i try get them by atmega and display via serial console then the results are different.
[16:30:05] <Daulity> also your send str usart function where is it ?
[16:35:41] <hetii> Daulity: here you have it: http://pastebin.com/AXvqd7xa
[16:36:24] <hetii> but i check the uart communication by connecting txd with rxd, and was able to see in terminal what i type so this part works fine
[16:41:59] <malinus> $56, not THAT bad http://www.ebay.com/itm/7-inch-LCD-Screen-Display-Monitor-for-Raspberry-Pi-Driver-Board-HDMI-VGA-2AV-/281317093355?pt=LH_DefaultDomain_0&hash=item417fce2feb
[16:42:28] <malinus> but.. 800x480...
[16:42:30] <malinus> wow
[16:49:43] <hetii> Daulity: any clue ?
[16:50:03] <Daulity> hetii: you would normally wait first then send in your put function
[16:50:26] <Daulity> like i did here: https://github.com/Duality4Y/projects/blob/master/atmega16-4/uart.cpp
[16:51:02] <Daulity> in my uart_put function
[16:52:14] <Daulity> because if you do UDR = data; and then send there is a possibility you send garbage. (correct me if i am wrong :)
[16:53:10] <Daulity> this version of mine is better: https://github.com/Duality4Y/projects/blob/master/School_Safe_Software/SafeSoftware/libs/uart.c
[16:56:30] <hetii> Daulity: ok will try with your uart_put function first.
[16:58:19] <hetii> Still the same result.
[16:59:18] <hetii> I suppose there is something wrong with snprintf(..)
[17:22:53] <hetii> Daulity: yep, definitely something is wrong with my snprintf, when i did uart_put(get_usart()); then i got my hex values in pc
[17:39:35] <hetii> Daulity: Why you use uart_put(0x04); in uart_put_str?
[17:42:44] <Daulity> hetii: oh that was for end of transmission if you look it up in the ascii table, it was needed for a project i was working on, but you normaly don't need it :)
[17:43:24] <hetii> ok fine :)
[17:46:02] <Daulity> all i know is that printf functions are expensive on avrs and there for i normaly affoid them
[18:01:45] <malinus> I haven been running my atmega, and using the adc without AVCC connected. is it screwed?
[18:02:54] <Daulity> malinus: is it malfunctioning ?
[18:03:57] <malinus> Daulity, well the reading were kinda off (I was using the internal 1.1V and measuring the VCC), but lets see what happens when I connect VCC to aVCC
[18:07:04] <malinus> how important is it to connect it via a LC network as shown in the datasheet? I don't happen to have any
[18:07:58] <Daulity> depends on how "good" you want you readings to be. it's for noice cancelation iirc and normaly not needed
[18:08:20] <malinus> so I can live without the inductor
[18:08:29] <malinus> good, I just add some caps ;)
[18:08:54] <Daulity> i have never used any inductors for this purpose yet. :)
[18:10:17] <malinus> well thank you atmel engineers for making some kind of circuit so the adc won't get destroyed when used without power :)
[18:11:36] <Daulity> i don't know if they did that, but in my experience avr chips are hard to break :)
[18:12:57] <malinus> yeah I've powered my attiny directly from a 9V. It didn't even twitch. but it didn't run either ;P
[18:13:11] <malinus> well it didn't run from 9V, but worked fine later
[18:22:14] <Daulity> i have had only one avr break so far, and that was just because i was stuppid enough to feed 12v directly
[18:22:34] <Daulity> it released smoke, so i think it won't work ever again.
[18:23:31] <hetii> Daulity: and this code work: http://pastebin.com/hVdPe3cr
[18:23:34] <hetii> :<
[18:24:46] <hetii> so when its executed in interrupter then shit happens:(
[18:25:05] <Daulity> hetii: it might be that printf is a function that takes relatively long to execute and while your in the interupt you can't recieve any data.
[18:25:30] <Daulity> besides you want to do as little as possible in interupts
[18:26:15] <hetii> thats true
[18:27:15] <hetii> but it make me crazy when I spend few hour to find such things :/
[18:27:32] <hetii> Its so unproductive :/
[18:31:00] <Daulity> it's productive on the long term ?
[18:31:09] <Lambda_Aurigae> so is having a cement truck run into the high voltage feed to the town you live in.
[18:31:42] <Daulity> totaly cause my laptop battery only lasts 10 minutes :D
[18:31:43] <Lambda_Aurigae> it was apparently rather impressive though.
[18:31:57] <Lambda_Aurigae> including blowing out the tires on the truck.
[18:32:13] <Daulity> i imagine, high voltage does that
[18:32:24] <Daulity> the driver was safe though ?
[18:32:30] <Lambda_Aurigae> dunno.
[18:32:35] <Lambda_Aurigae> they had it cleared before I got home.
[18:32:38] <Lambda_Aurigae> but I suspect so
[18:32:45] <Lambda_Aurigae> as there were no police or ambulances.
[18:34:23] <Daulity> he was if the cabine wasn't made out of fiber
[18:34:49] <malinus> I've killed a attiny when trying to desolder it
[18:34:58] <malinus> rip