#avr | Logs for 2016-02-21

Back
[02:28:19] <Jartza> morning
[04:08:55] <prajagopal> hello. I'm looking for some expertise on avr gsm modules
[04:09:32] <prajagopal> how exactly does a AVR GSM work? Since it can work with any sim card, I am sure there is an underlying protocol beneath AT commands.
[04:09:56] <prajagopal> I wish to make my own gsm modem. But I am unable to find any data on what protocol sim cards work on.
[04:12:48] <sebus> prajagopal you mean this one https://www.olimex.com/Products/AVR/Development/AVR-GSM/resources/AVR-GSM-Rev.B-schematic.pdf ?
[04:13:04] <sebus> you need a datasheet for SIM300D, easily to find one.
[04:38:04] <prajagopal> sebus: even with a data sheet, would I be able to find the exact hex protocol for the sim?
[04:38:17] <prajagopal> yes, that's the schematic
[04:46:48] <x29a> prajagopal: do you want implement a modem or do you want to use a modem?
[04:47:02] <prajagopal> x29a, I want to make a modem
[04:47:16] <prajagopal> I am making this for a product that has space constraints
[04:47:17] <x29a> so you start with the sim and want to talk to the operator?
[04:47:22] <prajagopal> exactly
[04:48:07] <prajagopal> I saw the pin connections for a sim, and they seem pretty normal. One data line, one gnd, one VCC. CLK, etc.
[04:48:16] <prajagopal> But I can't find any common document that explains the iDD
[04:48:17] <x29a> thats going to be harder and highly likely forbidden, as operators dont want people to use their own modems in their ned. a good start might be http://bb.osmocom.org/trac/
[04:49:05] <prajagopal> x29a, have you worked on something similar before?
[04:49:13] <prajagopal> could I dm you?
[04:50:39] <x29a> no i havent, but i know from the #neo900 project that opensource basebands are not possible
[04:51:20] <x29a> prajagopal: what size constraints to you have?
[05:13:16] <julius> morning
[05:13:43] <julius> got a simple function that returns either a or b, but when i enable that the code stops working: http://codepad.org/Rv1MS1Oh any ideas?
[05:14:13] <julius> commenting out line 29 and the code works, with this function active the uart is not sending anything back
[05:21:19] <cehteh> you are not doing uart with interrupts?
[05:25:52] <cehteh> what terminal emulator do you use? something line buffered?
[05:27:36] <julius> this example does not use interrupts, at least not for sending/receiving
[05:28:03] <julius> let me check the line ending
[05:29:17] <julius> ah yes, line ending is \r\n
[05:30:03] <julius> but doing return "a\r\n" is of course invalid, how can i attach that?
[05:30:57] <cehteh> its a bit more complicated :D
[05:32:06] <cehteh> you can only put one byte at a time into UDR0 ..
[05:32:47] <sebus> julius manage a packet to return data with cr lf or "\r\n"
[05:35:20] <cehteh> while(ready to read); received = UDR0; while(!ready to send); UDR0 = calculate_freq(); while(!ready to send); UDR0 = '\r'; while(!ready to send); UDR0 = '\n';
[05:35:55] <cehteh> something like that could be the simplest test case, but it wont really work for anything serious
[05:36:13] <cehteh> you'll loose a lot characters
[05:37:11] <cehteh> because sending and receiving speed is the same, but for each byte received you send 3 bytes (which takes 3 times the time) .. loosing 2 chars on the receiving side meanwhile
[05:37:19] <julius> ah, got it
[05:37:36] <cehteh> you should really learn how to do this with interrupts
[05:37:40] <sebus> cehteh rx interrupts
[05:37:42] <cehteh> and queues
[05:37:51] <cehteh> sebus: yes
[05:38:26] <cehteh> i only try to push him into the right direction :D
[05:40:00] <julius> sure, loosing information is bad
[05:40:08] <julius> but for now i just want my sensor to output anything
[05:40:12] <cehteh> there are simple examples around on the net, you can aslo look at my code (works except for the utf8 handling, going to fix that now :D)
[05:40:36] <cehteh> really interrupts are not magic its much easier
[05:40:52] <cehteh> whenever your sensor has some data to print it formats that nicely pushes that onto a queue
[05:41:20] <cehteh> and the "TX Ready" interrupts sends the data byte by byte from that queue
[05:41:36] <julius> so basically the last day i was hunting around my code for errors and all that was missing was the right line termination
[05:41:37] <julius> crap
[05:41:38] <cehteh> in the simplest case this is really easy
[05:42:06] <cehteh> also the avr-libc supports some stdio abstraction where you can hook this in, then you can use normal C stdio
[05:42:17] <julius> i will
[05:42:26] <cehteh> or look at my mµOS :D
[05:42:41] <cehteh> doing its own io library for some reaons
[05:44:22] <theBear> huh wha ? what's a muOS ? you implying your own little env/os has somehow gone off independently of you and started doing stuff ? (no no, not like terminator movies, maybe you got anonymous/early contributors to a public revision control system ? i dunno :)
[05:45:09] <cehteh> just scheduler and io for now
[05:45:32] <cehteh> much work on progress
[05:45:52] <sebus> cehteh something alike rtos?
[05:46:00] <sebus> I want to see it :D
[05:46:29] <cehteh> very very simple .. idea is to queue/schedule functioncalls, no threads, single stack only
[05:46:48] <cehteh> and not posix or something else conforming
[05:47:30] <cehteh> git://git.pipapo.org/muos
[05:47:52] <theBear> i meant re: look at your os, doing it's own io lib.... that ain't hwo you talk if you are the one doing it :)
[05:48:50] <cehteh> eh ok :D i meant i do :D
[06:25:37] <julius> cehteh, thank you
[06:31:38] <cehteh> have it working now?
[06:33:59] <theBear> ah good, just checking
[06:38:36] <julius> kinda
[06:39:31] <julius> had to solder some smd components for the sensor im not really sure if they both survived that
[06:45:30] <cehteh> oops
[06:52:07] <julius> tmp = 214748UL; ltoa (tmp,buffer,10); <- will this give me a 0x00 terminated string?
[06:54:43] <cehteh> no
[06:56:11] <cehteh> err yes
[06:56:52] <cehteh> sry :D ..
[06:57:26] <cehteh> but you have to provide a buffer with enough space to hold the \0
[06:59:07] <cehteh> 32bit integers in base10 can be up to 11 characters long (including leading minus sign) so your buffer should be 12 bytes at least unless you are sure you never ever need that full range
[07:02:50] <cehteh> have you seen my simple circular buffers implementation? for rx/tx buffers?
[07:05:03] <cehteh> .. and guess why i recently needed a integer to string coversion which is restartable ...
[07:07:53] <cehteh> bbl
[08:00:15] <cehteh> re
[08:09:23] <julius> i need to get results first before thinking about different rx/tx implementations
[08:09:47] <julius> all i want is to count the frequency on T0 and send me that value via bluetooth
[08:14:37] <cehteh> wouldnt it be easier the other way around, having a working uart (tested with some other data) and then attach your sensor?
[08:15:13] <cehteh> btw goal with mµOS is that writing such things becomes trivial,
[08:15:37] <cehteh> (may already work for your simple thing, but generally i am not there yet)
[08:16:51] <cehteh> what frequency do you expect to count? slow one, fast one?
[08:48:14] <julius> ive got a working echo uart example
[08:48:24] <julius> i dont need all sensor data, just some sane values
[08:48:59] <julius> im not sure what frequency the sensor will output, the german documentation is as usual non existent
[08:49:27] <julius> http://www.dietmar-weisser.de/elektronik-projekte/analogtechnik/sensoren/bodenfeuchtesensor.html
[08:50:32] <julius> http://paste.pound-python.org/show/IIwsTdfk6zxvqytjGS4E/ <- shouldnt this led go on every second, and out the next?
[08:51:36] <cehteh> Je nach Fläche des Kondensators liegt die Frequenz zwischen einigen 100kHz und mehreren MHz
[08:51:39] <cehteh> outch
[08:51:45] <julius> oh, sry
[08:52:32] <cehteh> i planned to make the sensors more intelligent, speaking some digital protocol
[08:52:58] <julius> there is a i2c moist sensor out there, but this one made it to my home
[08:53:06] <cehteh> measuring mhz with a timer sounds hard for a atmel (not impossible but a lot)
[08:53:49] <julius> could you take a look at the paste.pound link? i dont get whats wrong with that. the led isnt going on at all
[08:54:08] <cehteh> replace PORTB ^= (1 << LED1); to PINB = (1 << LED1);
[08:55:01] <cehteh> why do you change wgm?
[08:55:24] <cehteh> thats the 16bit timer?
[08:55:34] <julius> i did not cut down that example completely
[08:55:40] <julius> comes from the moist sensor
[08:55:46] <Caesium> cehteh: why replace the PORTB line? that looks right to me
[08:56:05] <cehteh> Caesium: because its simpler
[08:56:26] <cehteh> writing bits into PIN toggles the pin in hardware
[08:56:47] <julius> ah
[08:56:53] <cehteh> while PORT ^= needs first to read the port into a register, xor, write back
[08:56:58] <Caesium> gotcha
[08:57:08] <julius> still, no blinky
[08:57:27] <cehteh> julius: ah you forgotten DDR .. set that pin as output
[08:57:42] <julius> oh no
[08:59:36] <julius> now the led is on and stays on
[08:59:49] <julius> do i need to reset some interrupt flag for timer2?
[09:00:13] <cehteh> no
[09:00:43] <cehteh> PORTB ^= to PINB =
[09:00:51] <cehteh> note the = not ^=
[09:01:42] <julius> i did indeed change it back to PORTB because it makes the code more understandable
[09:01:52] <julius> but lets test it back
[09:02:36] <julius> in my humble mind at least
[09:02:48] <julius> still no blinky
[09:03:32] <cehteh> 15625 .. is what freq ?
[09:04:47] <julius> timer2 interrupt should go off every second
[09:04:56] <julius> 16mhz / 1024 prescalar
[09:05:10] <julius> ~15000
[09:06:27] <julius> 16000000/1024 = 15625 65535/15625 = 4.1s
[09:06:38] <cehteh> ok
[09:06:49] <cehteh> mhm i dont see any oblivious error
[09:06:58] <cehteh> but i havent checked in detail
[09:07:20] <julius> 65535 / 4.1... = 15625
[09:07:25] <cehteh> timer_counter = 0;
[09:07:25] <cehteh> TIMSK = _BV(OCIE0A);
[09:07:25] <cehteh> OCR0A = TIMER_TICK;
[09:07:25] <cehteh> TCCR0A = _BV(WGM01);
[09:07:26] <cehteh> TCCR0B = TIMER_DIV1024;
[09:07:34] <cehteh> ... from some code i use here on a attiny
[09:07:52] <julius> ok thanks, will take a break and look at the registers
[09:08:21] <Caesium> what attiny are you using julius?
[09:08:28] <cehteh> he uses a mega8
[09:08:30] <julius> atmega168
[09:08:31] <Caesium> aha
[09:08:32] <cehteh> so not exactly
[09:08:35] <cehteh> ah 168
[09:08:57] <cehteh> my other timer code for the 368p is not so simple :D
[09:09:16] <cehteh> using 8bit timer for now, overflow and priority queues
[09:09:41] <cehteh> wont do well as example
[09:09:50] <julius> sounds complicated
[09:10:15] <cehteh> yes .. but can schedule different events at any time
[09:10:38] <cehteh> and in future there will also be a long time queue where you can say "schedule once a week" or so
[09:11:10] <cehteh> using it is much easier, the complicated stuff is hiden in the back
[09:12:12] <cehteh> http://paste.pound-python.org/show/amOEvaKDH5FVNC0ERNol/
[09:12:21] <cehteh> thats blinking a led every 250ms
[09:13:51] <cehteh> http://public.pipapo.org/pulseview1.png channel 5
[09:15:06] <julius> sounds good
[09:15:14] <julius> and that will run on atmega as well?
[09:15:51] <julius> muos_clpq_repeat <- clpq is to short...use longer more meaningfull variables
[09:15:51] <cehteh> that is atmega
[09:16:09] <cehteh> someday i go over it and document it
[09:16:21] <julius> or you will end up with methods called "ltoa" .... completely usesless name
[09:16:30] <cehteh> clpq > clock priority queue
[09:16:42] <julius> ah ok
[09:16:54] <cehteh> there are some renames pending
[09:17:05] <cehteh> its nowhere to be released, pre alpha
[09:35:01] <julius> you know how it is with "im gonna write that documentation later..." ;)
[09:39:55] <cehteh> nah .. i am serious about that
[09:40:32] <cehteh> my other stuff is well documented, i even have my own documentation system, but this is currently pending because i wanted to make a new version of that first
[09:41:25] <Lambda_Aurigae> hmm
[09:41:32] <Lambda_Aurigae> document the documentation documents.
[09:41:36] <Lambda_Aurigae> reminds me of the military.
[09:41:45] <cehteh> yeah self documenting documentation system :D
[09:42:00] <Lambda_Aurigae> was a manual to tell us how to update manuals.
[09:42:51] <Lambda_Aurigae> and we got updates to the manual update manual about once a month.
[09:43:16] <cehteh> basically i just use asciidoc .. but i have some extractor which extracts documentation pieces out of sources and other documents, can generate a glossary and index and finds things like //FIXME: etc and includes them into a issues list etc
[10:56:29] <julius> timer2 declared war on me
[11:02:36] <Casper> julius: you sure that it is not you that declared war on timer2?
[13:43:49] <julius> no
[13:43:52] <julius> im friendly
[13:44:32] <julius> it agreed to cooperate if i put a 8bit value in OCR2a and not 15xxx
[13:44:50] <julius> anyway, i switched to timer1
[13:44:57] <julius> now my led blinks nicely ever second
[13:45:12] <Caesium> I did wonder earlier if it had a 16bit timer actually, thats why I asked which attiny, heh.
[13:45:23] <Caesium> but when you said it was a mega I assumed they had loads of 16bit timers
[13:46:08] <julius> they do
[13:46:14] <Caesium> just not timer2?
[13:46:15] <julius> i just grabbed the wrong one
[13:46:42] <julius> cant say, but i know that OCR1A is 8 bit
[13:51:57] <julius> now i got my led blinking a 1s from the ISR, is there also a way to get data from the ISR into main() withotu checking constantly from main?
[13:52:49] <Caesium> the usual idiom is just to set a boolean marker in your ISR then check for that in main
[13:52:57] <Caesium> keep the ISR extremely short and fast at all costs
[14:05:32] <julius> IT WORKS
[14:05:38] <julius> i love you guys
[14:06:39] * julius puts a box of cold becks into the room
[14:11:06] <Lambda_Aurigae> I prefer a good aussie lager myself.
[14:11:17] <Lambda_Aurigae> VB in the red can preferably.
[14:13:08] <Lambda_Aurigae> but, I got spoiled by aussie beer in the late 80s.
[14:29:41] <Jartza> julius: we loves us too!
[14:50:26] <LeoNerd> Random thought: are AVR pinchange interrupt numbers always aligned with port designations?
[14:50:43] <LeoNerd> E.g. I notice on a 328P, pcint0 is portb, pcint1 is portc and pcint2 is portd
[14:50:59] <Lambda_Aurigae> LeoNerd, yeah.
[14:51:18] <Lambda_Aurigae> I do believe that is so.
[16:43:27] <julius> is it possible that a defect mosfet conducts all the time?
[16:43:58] <julius> n-channel
[16:44:08] <Lambda_Aurigae> possible, I suppose
[16:45:56] <julius> hm, theres a shotky in parallel to the dc motor
[16:46:07] <julius> that should have prevented destruction of the mosfet
[17:07:55] <Casper> julius: fet often fail that way
[17:08:00] <Casper> they melt internally
[17:09:22] <julius> wasnt my first choice, my first choice wasnt available in the shop
[17:10:30] <julius> i did run it with Vgs from the avr only for short ammounts of time, but apparently not short enough
[17:10:36] <julius> it probably overheated
[17:12:40] <julius> shouldnt there be a RDSon for different Vgs values in the datasheet?
[18:19:47] <LeoNerd> Oopsie. I forgot to put a cap on AREF (of a mega328)
[18:20:21] <LeoNerd> I wonder if I can bodge one in, between the soldered pin and the ground pour right beside. A good ol' 0603 should be fine :)
[19:09:31] <Casper> LeoNerd: the chinese did worse than that
[19:22:19] <theBear> hell yeah you can ! you're the nerd ! ("i'm a scientist... i can wire anything into anything !")
[19:22:57] <Lambda_Aurigae> I wired an AM radio into the brain of a frog once.
[19:23:04] <Lambda_Aurigae> frog didn't survive, but,
[19:24:09] <Lambda_Aurigae> it did twitch in time to the transmitter button being pressed for a while though.
[19:24:26] <Lambda_Aurigae> we were trying to make a remote controlled frog.
[19:26:21] <Lambda_Aurigae> I was about 14 or so at the time.
[19:30:48] <aandrew> Dr. Frankenstein, I presume...
[19:32:45] <Lambda_Aurigae> naaa
[19:32:50] <Lambda_Aurigae> frog started out alive.
[20:01:21] <theBear> you spelled atadpole wrong :)
[23:24:36] <metanosulfonico> anywhere have used a pololu avr programmer?
[23:25:32] <Casper> never hear of it
[23:26:53] <metanosulfonico> this is https://www.pololu.com/product/1300
[23:29:10] <Casper> the fact that it have a windows software worry me, but the feature look ok
[23:30:55] <Casper> also, the screenshot are from XP, which may mean that the software may not work on all windows, and may be abandonware at any time...
[23:31:10] <metanosulfonico> the windows software install the drivers and configure the programmer,
[23:31:29] <Casper> exactly
[23:31:43] <Casper> when they will not make a driver for the next windows, which they may not do, then too bad
[23:32:13] <Casper> starting from windows 7, a driver must be signed. There is a workaround, but... yeah...
[23:32:19] <Casper> driver signing is kinda expensive
[23:32:40] <Casper> so for me, that is not a good solution
[23:33:40] <metanosulfonico> function good in windows 8, but i cant program any device
[23:35:38] <Casper> so may not function at all then
[23:36:31] <metanosulfonico> mmm, the problem is the comunication of the device with avrdude
[23:37:04] <Casper> or the driver
[23:38:13] <metanosulfonico> the pc detect the programer and the software on the pc and avrdude, when i try burn the device, this fail
[23:38:51] <Casper> what happend? bad signature? valiation failed?
[23:39:20] <metanosulfonico> error in comunication
[23:39:26] <metanosulfonico> bad time of response
[23:39:51] <metanosulfonico> generally
[23:40:09] <Casper> so may be driver related (see what I mean by it is a problem?)
[23:40:29] <metanosulfonico> maybe, i check this
[23:41:05] <metanosulfonico> what programmer recomend me?
[23:42:07] <Casper> I personally use Tom_itx's programmer, and love it
[23:43:32] <metanosulfonico> i dont know
[23:47:09] <metanosulfonico> and what interface for the programmer recommend me?
[23:47:53] <Casper> from pc to programmer? or programmer to avr?
[23:48:11] <metanosulfonico> from pc to programmer
[23:48:27] <Casper> usb, serial are basically gone
[23:48:34] <Casper> and usb-serial adapter do not work for that
[23:48:50] <MarkX> anyone implemented a trapezoidal motion control profile on an avr by any chance?
[23:49:00] <MarkX> or worked with motion profiles at all?
[23:49:05] <MarkX> i'm having some issues
[23:50:57] <metanosulfonico> and what software for the programmer recommend me?