#avr | Logs for 2015-02-27

Back
[03:03:29] <EI24> Hi, when including a file like, .include <m329def.inc> . What is this for? My guess is from reading the .inc files, that they define syntax for a specific MCU device. So, is it obligatory to include them? What is the diffrence between including this file and using .device xxxxx ? Also i did not find the .inc file for atmega328/p .
[03:05:23] <EI24> I also read this, http://www.atmel.com/webdoc/avrassembler/avrassembler.wb_directives.html though the description on .include does not answer this question. The .device directive seems not to be documented also.
[04:20:36] <specing> EI24: look into it and you'll get the idea
[05:41:12] <EI24> specing: yes thats seems to be the way to learn many times
[05:46:05] <Lambda_Aurigae> concerning the ADC question last night....you can only read adc on one pin at a time..other pins can be used as gpio during that time....there is only one ADC and an analog switch system to select which pin you are going to read.
[07:15:48] <ecilop> diff pair ADC mode..
[07:15:58] <ecilop> 2 pins used
[07:17:33] <Lambda_Aurigae> that's a whole other pile of penguins entirely.
[07:18:51] <specing> needs more Linux
[07:19:53] <Lambda_Aurigae> or less windows...either way.
[07:20:33] <ecilop> macos
[07:21:20] <Lambda_Aurigae> eeeww!
[07:21:36] <Lambda_Aurigae> love the back end of macosX but the frontend drives me nuts.
[07:22:59] <ecilop> linux will be "windows like" soon
[07:23:13] <ecilop> thanks to "systemD"
[07:39:17] <twnqx> you mean systemd/linux will replace gnu/linux?
[07:39:25] <ecilop> yes
[07:39:51] <ecilop> many distribs choose systemd by default
[07:39:59] <twnqx> mine doesn't \o/
[07:40:01] <ecilop> gnu/debian is dead
[08:48:32] <Jesper--> I'm an electrican but my hobby is programming/electronics (self taught through the past 10-15 years) and I would like to take it a little further,but am unsure on which education would suit me best. I like programming microcontrollers and would like to move to embedded linux.I'm not that interested getting to deep into the electronics part, but would like to have a good understading of it, without all the details.I would like to really get into the pro
[08:48:36] <Jesper--> gramming part, embedded linux, bootloaders, networking and stuff like that.Does anybody know of a university that has an online BSc degree in something like this?
[09:19:00] <rue_more> do you know systemD is a coding catastrophy?
[09:19:31] <EI24> Jesper--: Im a newbie, doing programming on my freetime. I been doing for like 2 years now or something. My suggestion would be to just look up courses of the subjects your interested in. Should not be that hard to find. Also if you dont want to work with programming, just spending more freetime on programming you will take i futher :). Just have fun! Thats the best motivation for doing anything in my opinion.
[09:30:16] <Jesper--> EI24, Thanks for you suggestion. What you describe is what I've been doing for years now. I just think a degree would help me alot. Not that I'm looking for a new job, cause I probably would't make more than I do now, but just to get some basics sorted and start in some more advanced topics. I've been looking at alot of online universities, and from what I understand, the standard of some of them are as good as an ordinary university. The best one I've
[09:30:16] <Jesper--> found so far is this: http://www.openuniversity.edu/courses/computing-and-it/bsc-honours-computing-and-it but looking through the details I see that they teach programming in java, and I'm more interested in low level programming. Preferably in C/C++
[09:31:43] <Rickta59> what do you want to end up creating Jesper-- ?
[09:32:18] <EI24> search for system programming
[09:32:21] <EI24> like
[09:32:26] <EI24> linux system programming
[09:32:41] <learath> I wonder if people teaching Java realize they are teaching how to program exactly wrong
[09:35:35] <Jesper--> I have an idea for a device that I would like to create. It's pretty simple actually. It involves programming a lot of different industrial communication protocols, so that It can talk with different types of PLC's (Programmable logic controllers). It should run a web server to set et up/configure it and it should be able to connect to SQL servers
[09:40:49] <Jesper--> I come from the industrial automation field and there's a niche that nobody has done anything about yet.
[09:42:48] <Jesper--> I work full time (actually 1 month on/ 1 month off), so I don't have time to study full time
[09:46:10] <EI24> looks like you have found your area of interest. there is definitely job and innovation opportunities out there.
[09:50:05] <twnqx> Jesper--: as soon as you say "webserver" i woul dlike to recommend you use something beefier with an OS.
[09:50:14] <twnqx> raspi2, beaglebone, ...
[09:51:11] <Jesper--> Yes, the interest is definitely there, and I basically know what I want to make, but embedded linux on a custom PCB is pretty steep for me
[09:52:33] <Jesper--> twnqx - Yes, I know this is #avr but I figured that people here would have knowledge about these things :)
[09:53:31] <twnqx> i'd start with some stock device still
[09:53:50] <twnqx> get to the interesting software part without having to go to the nitty-gritty details
[09:54:08] <twnqx> besides, i think that all hand-solderable µCs are... not so great
[09:54:17] <Jesper--> I'm ordering a beagleboard and will start with that, but when the time comes I would have to design my own
[09:54:26] <twnqx> and designing for the higher performance arms with external dram is... wow
[09:54:54] <twnqx> BGA, differential signals, same tracelength to a few µm, ...
[09:55:48] <Jesper--> I've bought a book called "Embedded Linux Primer: A Practical, Real-World Approach" hoping that, that will get me started
[09:56:10] <twnqx> no idea
[09:56:12] <twnqx> i own a pi
[09:56:18] <twnqx> i booted it twice before giving up
[09:56:20] <twnqx> :P
[09:56:31] <twnqx> also, not sure if pi counts as embedded linux. probably not.
[09:56:37] <twnqx> i think all of those do not.
[09:57:54] <Jesper--> they do count as embedded linux
[09:58:49] * twnqx disagrees
[09:58:58] <twnqx> if it runs debian, it's not embedded
[09:59:04] <twnqx> that's a full fledged linux
[09:59:18] <Jesper--> you can roll your own and download it to either of them if you want. I just think the beagle bone is "more basic" and that's why I would like to start with that
[10:00:56] <Jesper--> I have another book called "Exploring BeagleBone Tools and Techniques for Building with Embedded Linux"
[10:16:11] <EI24> I started learning C++, i belief that i would of the bat begin writing games, with graphics and all. So i learned that you had to use libraries that where built on a OS API. So i got really frustrated that i didnt know what was going on behind the scenes, so i tried to program the linux framebuffer instead, with the linux API. And realized that there were soooo much to learn. Just recently i read a book about basic computer principles and now
[10:16:11] <EI24> im so interested in assembly programming i just gave up higher level programming all together. The thing that you really get to know what is going on behind the scenes makes it much more appealing to me.
[10:16:33] <EI24> ops wasnt going to be such a long message..
[13:10:56] <CovertOps> hi i'm trying to use timer1 prescaled to /1024 but
[13:11:03] <CovertOps> it appears to be running at half speed
[13:11:19] <CovertOps> i'm using an external 16mhz crystal with fuse bits set for external crystal
[13:11:52] <CovertOps> but the simple compare interrupt blink sketch is blinking at maybe 4 seconds instead of 1
[13:12:03] <CovertOps> i set to clk/256 and i get 1 second
[13:12:39] <Tom_itx> what about ckdiv8 fuse?
[13:12:54] <CovertOps> nope, not set
[13:13:02] <CovertOps> hang on i'll give you my fuse settings
[13:13:12] <Tom_itx> no time to look right now
[13:14:08] <CovertOps> L:FF, H:DA, E:05
[13:14:23] <CovertOps> default for external crystal, no clock/8, no BOD
[13:16:40] <Tom_itx> did you #define F_CPU?
[13:20:11] <CovertOps> don't think so
[13:20:26] <CovertOps> isn't that pre-defined somewhere?
[13:21:31] <Tom_itx> no
[13:21:57] <Tom_itx> it would be wrong anyway if you added a 16Mhz crystal
[13:22:45] <CovertOps> i would've assumed since i'm using the default arduino library, and since all their boards come with an external 16 mhz crystal, that they would've pre-defined that
[13:23:49] <Tom_itx> can't help you with the innerworkings of the arduino library
[13:23:51] <CovertOps> also, i thought in CTC mode, TCNTn was supposed to reset to 0 on a match with OCRnA
[13:23:59] <CovertOps> but it doesn't appear to be clearing the counter
[13:24:09] <CovertOps> i just put TCNT1 = 0; within my ISR and that worked
[13:24:50] <Tom_itx> http://tom-itx.no-ip.biz:81/~webpage/abcminiuser/articles/avr_timers_index.php
[13:24:53] <Tom_itx> you can read that
[13:25:16] <Tom_itx> part 4 ctc
[13:25:40] <CovertOps> well i added #define F_CPU 16000000L and it didn't change anything
[13:30:49] <CovertOps> also manually set system clock pre-scaler to 1 and still no luck
[13:31:52] <Tom_itx> i personally would ditch arduino and write it in c
[13:32:32] <CovertOps> i do avoid the pre-made functions when i can
[13:32:57] <CovertOps> but i'm lazy, i like the ide doing the compiling and uploading for me
[13:49:19] <CovertOps> well that didn't help
[13:49:34] <CovertOps> also f_cpu is defined in the bootloader
[13:49:48] <CovertOps> i already have it set as 16000000L
[13:54:48] <CovertOps> the datasheet says in CTC mode (that's the WGM12 bit set and WGM13, 11, and 10 cleared on TCCR1A/B registers), TCNT1 will reset to 0 when it matches OCR1A
[13:55:01] <CovertOps> but it's not doing that, so i put TCNT1 = 0; in my ISR
[13:57:49] <specing> CovertOps: #arduino
[13:57:57] <CovertOps> there too
[14:34:50] <CovertOps> http://pastebin.com/NqMsk7Wh
[15:55:20] <Shavik> On the Mega328, Can I use SPI along with using OC2B of Timer2 for a millisecond counter?
[15:55:42] <Shavik> Using OC0x and OC1x for motor pwm output
[15:58:41] <hje841> Hi I'm following this: http://www.embedds.com/programming-avr-usart-with-avr-gcc-part-1/ and I have set up minicom with 9600 8N1 but the help bar says 'Disconnected'. I'm on Arch Linux. Any ideas?
[16:14:59] <ferdna> hje841, you need to give permissions to your serial port ttyXXXX
[16:15:46] <ferdna> and add yourself to that group
[16:19:13] <hje841> ferdna, I have done that already. I run minicom with no problems. it opens /dev/ttyUSB0
[16:26:32] <ferdna> hje841, thats the wrong port
[16:27:50] <ferdna> /dev/ttyACM0
[16:27:53] <ferdna> try that one
[16:29:28] <ferdna> chmod a+rw /dev/ttyACM0
[16:30:46] <ferdna> and you need to be in this groups
[16:30:48] <ferdna> ttyl
[16:30:49] <ferdna> serial
[16:30:51] <ferdna> uucp
[16:31:13] <ferdna> let me know if you have any problems...
[16:31:22] <ferdna> i got a udev rule that works flawlessly...
[16:31:41] <RikusW> he'll need to edit udev rules to make it permanent
[16:32:02] <RikusW> ATTR{idVendor}=="03eb", ATTR{idProduct}=="2018", MODE="660", GROUP="dialout", ENV{ID_MM_DEVICE_IGNORE}="1"
[16:32:23] <hje841> dmesg tells me that my FT232RL chip is connected to /dev/ttyUSB0
[16:32:24] <RikusW> edit vendor and product id to match yours
[16:32:46] <ferdna> hje841, just try it... if it works it works if it doesnt it doesnt
[16:33:21] <RikusW> or sudo minicom to test....
[16:33:51] <ferdna> yeah that will be best bet... go root...
[16:33:57] <ferdna> good call rikusw
[16:34:40] <RikusW> :)
[16:34:50] <ferdna> i gtg now
[16:34:54] <hje841> RikusW, that udev rule doesn't seem to fit my lsusb output for the FT232 chip
[16:35:18] <ferdna> hje841, do this: go root then try that port i gave you.
[16:35:32] <RikusW> you'll need to edit the product and vendor id...
[16:35:56] <RikusW> and add yourself to the dialout group too
[16:36:36] <RikusW> ( sudo vim /etc/group )
[16:39:54] <hje841> nothing seems to help. when I start minicom, it won't let me enter anything
[17:48:40] <CovertOps> still no luck figuring out the timer/counter
[17:49:01] <CovertOps> tried it on my arduino micro and i again get like 1/4 speed
[18:27:17] <CovertOps> so weird. if i try to use the timer output compare match interrupt, it only interrupts at 1/4 speed, but if i use the overflow and just reset the counter to 0xffff-15624, i get 1 second interrupts
[18:28:15] <Fleck> CovertOps: hmm, div8 fuse is not set?
[18:28:57] <Tom_itx> we discussed that earlier
[18:29:09] <Fleck> ohh
[18:29:11] <Fleck> sorr
[18:29:18] <Fleck> didn't read log
[18:29:32] <CovertOps> yeah, not set
[18:29:34] <Tom_itx> as well as the F_CPU etc
[18:29:45] <CovertOps> F_CPU is actually automatically set by the bootloader
[18:29:52] <CovertOps> depending on fuses, etc
[18:29:57] <Fleck> so how about code?
[18:30:00] <CovertOps> i checked my bootloader makefile
[18:30:04] <CovertOps> k hold on
[18:31:07] <CovertOps> http://pastebin.com/J8TgnFB5
[18:31:12] <CovertOps> that's with using the overflow interrupt
[18:31:19] <CovertOps> get a nice even 1 second on, 1 second off on the led blink
[18:32:02] <CovertOps> oh also, that's on the micro, so timer1 on atmega328p is timer3 on atmega32u4
[18:32:14] <CovertOps> i'm having the same issue on both devices
[18:34:14] <CovertOps> http://pastebin.com/x4tXJhXJ
[18:34:21] <CovertOps> there's code with compare match interrupt instead
[18:34:51] <CovertOps> same prescale settings, but with CTC mode enabled and OCR3A set to 15624
[18:35:00] <CovertOps> for some reason i get 4 seconds between interrupts
[18:35:10] <CovertOps> it's like CTC mode is running at clk/4
[18:35:27] <CovertOps> i've read through both 328p and 32u4 datasheets extensively
[18:41:49] <Fleck> CovertOps: your clock speed?
[18:47:12] <Fleck> 16MHz I read from above
[18:50:20] <Fleck> CovertOps: first paste - timer will overflow after ~3 seconds if my calculations are ok, sorry, kinda sleepy! :D
[18:50:40] <Fleck> ohh no, wait
[18:51:04] <Fleck> after 1 second, sorry
[18:57:10] <CovertOps> yeah the point is that it interrupts at 1 second
[18:57:19] <CovertOps> the first basically sets the timer at max - 1 second
[18:57:26] <CovertOps> then interrupts when it overflows
[18:57:30] <CovertOps> it works perfectly
[18:57:41] <CovertOps> but the compare match does not work as advertised in the data sheet
[19:14:55] <Fleck> CovertOps: have you tried to set OCR3A after you set TCNT3 or just before?
[19:22:52] <Fleck> bedtime... afk!
[20:10:01] <CovertOps> i actually had tried that. i previously had OCR3A as the last thing set before TCNT3. i noticed in the example it was one of the first things set
[20:12:20] <CovertOps> oddly enough, i just did that and now it works
[20:12:24] <CovertOps> thanks Fleck
[20:12:36] <CovertOps> that's just effing weird though. why would that matter?
[20:17:16] <Lambda_Aurigae> order of operations sometimes makes a big difference with setting up timers.
[20:18:16] <CovertOps> strange sometimes
[20:18:25] <Lambda_Aurigae> yup.
[20:20:40] <CovertOps> well thanks!
[20:20:47] <Lambda_Aurigae> I didn' do it!
[20:42:16] <Lambda_Aurigae> \\// ,
[20:42:23] <Lambda_Aurigae> hmm..not quite right
[20:42:27] <Lambda_Aurigae> \\//,
[20:42:31] <Lambda_Aurigae> live long and prosper