#avr Logs

Mar 20 2017

#avr Calendar

12:43 AM rue_house: xentrac, no, gcc tells you that by the end of the file, the parens didn't match up
12:46 AM rue_house: the borland C compiler would tell you exactly where you error was
12:49 AM z3t0: hi
12:49 AM z3t0: does anyone know how to hook up a qrd1114 for black/white detection?
12:49 AM z3t0: I have it set for distance detection but need to tell black from white
12:54 AM rue_house: is that the colour sensor board with the output and the 3 inputs?
12:55 AM z3t0: no
12:55 AM z3t0: its an ir emitter diode coupled into a package
01:07 AM rue_house: ah
01:07 AM rue_house: the type that causes robots to run full speed into blue sneakers
01:08 AM rue_house: I know the ones
01:10 AM rue_house: www.IKnowHowToCompromiseYourRobot.calm
01:10 AM z3t0: no thats another haha
01:13 AM daey_ is now known as daey
01:23 AM enhering: good night
01:27 AM z3t0: night, enhering
01:39 AM z3t0: so data needs to be marked as volatile if used in interrupts and as a global, do functions called by the isr need anything similar
01:49 AM enhering: sometimes I believe all data should be marked as volatile...
01:49 AM enhering: I'm wrong, obviously
01:50 AM enhering: when in doubt, disable optimization (-S0) and test your code
01:50 AM Casper: z3t0: any global need to be volatile
01:51 AM Casper: also, take note that any global variable that is modified outside of the interrupt that is more than 8 bits should be atomically protected when you work with it
01:53 AM Casper: here's what can happend: main() read a 16 bits, it read the first 8 bits, interrupt kick in, modify the 16 bits, then the main resume and read the new second part of the 16 bits...
01:53 AM enhering: How do you atomically protect a variable, Casper ?
01:55 AM Casper: http://www.nongnu.org/avr-libc/user-manual/group__util__atomic.html
01:55 AM Emil: z3t0 Casper not really
01:55 AM Emil: volatile is about successive access to data
01:55 AM Casper: basically, it disable the interrupt during that block
01:56 AM z3t0: Emil: his explanation makes sense though
01:57 AM enhering: Thanks, Casper
01:57 AM Emil: if your interrupt reads a global into a variable just once volatile isnt needed. After that gcc may buffer the value in a register
01:58 AM z3t0: ok so then just to be clear theres no need to do anything with functions being called by isr?
01:58 AM z3t0: except any variables accessed by that functionwould also be marked volatile
01:58 AM Emil: It is also bad design if you run into concurrency issues
01:58 AM Emil: z3t0: only globals
01:59 AM z3t0: right
01:59 AM Emil: and only if you use them more than once
01:59 AM z3t0: what does "atomic" mean though
01:59 AM Emil: if it matters
01:59 AM Emil: z3t0: guaranteed that what you get when you start the op is what you gwt when you end it
02:00 AM z3t0: op?
02:00 AM enhering: ..eration
02:00 AM enhering: ?
02:01 AM Emil: z3t0: so if you are only interested in what a global var is at the start if an isr and then work with that value onwards, volatiles arent needed
02:01 AM Emil: this os often what you also do
02:01 AM Emil: enhering: ten points and a parrot pin to you :D
02:01 AM enhering: :)
02:01 AM Emil: (is a Finnish saying)
02:02 AM Emil: (Means you did well)
02:02 AM * enhering is happy
02:03 AM z3t0: also Emil one thing i didnt get is why you bothered using tctn1 in ping.c instead of ICR
02:03 AM z3t0: waiiit also
02:04 AM z3t0: tctn1a is a 16 bit register?
02:04 AM z3t0: so i would have to read it as 16 bits
02:04 AM Emil: z3t0: oh yeah oops :D
02:04 AM Emil: yeah read ICR1
02:04 AM Emil: It contains the actual event timestamp
02:05 AM Emil: and yes timer1 is 16 bits
02:05 AM z3t0: ok so i know how to read irc1 by doing irc1l and icr1h
02:05 AM Emil: no
02:05 AM z3t0: but how do i read the tcnt1 ?
02:05 AM Emil: for all the 16 bit registers
02:06 AM Emil: you can just do unsigned int i=REGISTER
02:06 AM z3t0: hmm
02:06 AM z3t0: but
02:07 AM Emil: no buts. GCC wraps TEMP access for you
02:07 AM z3t0: but...
02:07 AM z3t0: https://i.imgur.com/R1bwIWQ.png
02:07 AM Emil: yes it is talking at asm level
02:07 AM z3t0: ohhh
02:07 AM z3t0: thats good then
02:08 AM z3t0: because i was reading icr1l and then h before, apparently for no reason then
02:08 AM Emil: lol have you been reading them one by one and assembling the int's yourself :D
02:08 AM z3t0: um no....
02:08 AM Emil: wat
02:09 AM z3t0: only for the 16 bits
02:09 AM Emil: eh?
02:09 AM z3t0: so i did int a = icr1l | (icr1h << 8)
02:10 AM z3t0: ok now i have an important question
02:10 AM Emil: that is manually assembling the int and your order of access is also not defined
02:10 AM z3t0: why are arduinos so damn inefficient when avrs are pretty damn fast
02:10 AM z3t0: i mean how bad is the arduino code....
02:10 AM Emil: Because Arduino HAL is SHIT
02:10 AM Emil: heh
02:10 AM Emil: youbdobt evwn knpw
02:11 AM Emil: lemme show something
02:11 AM z3t0: it is right?
02:11 AM z3t0: HAL stands for?
02:11 AM Emil: https://emil.fi/jako/koodi/overhead.cpp
02:11 AM z3t0: ...
02:11 AM z3t0: ok lmao just start posting ads already haha
02:11 AM Xark: Hardware Abstraction Layer?
02:12 AM z3t0: ye
02:12 AM Xark: (i.e., cycle waste)
02:12 AM z3t0: Emil: ok but how is it that fuckign bad
02:12 AM Emil: z3t0: a) mentioned in the /avr document (didnt you read it?) and secodly can you not google?
02:12 AM Emil: z3t0: beats mw
02:12 AM z3t0: Emil: sry
02:12 AM Emil: Xark: well, hal doesnt have to waste cycles
02:12 AM Emil: Xark: shitty haö does
02:15 AM Emil: hal does*
02:15 AM Xark: Emil: True, but that is the exception...
02:15 AM Emil: yeah
02:15 AM Emil: hal's arent inherently bad
02:15 AM Emil: it is the usage and bad implementation
02:15 AM Emil: z3t0: also just a warning. If you go full retard or approach it, ima let you know like with everyone ;)
02:16 AM z3t0: thanks! friend ()/ Emil
02:16 AM z3t0: i dont know how to do proper ascii art
02:16 AM Emil: Asking questions before [verbification of your favourite search engine] them is one such offense
02:17 AM Emil: z3t0: time
02:17 AM Emil: also dont bother unless absolutely necessary
02:17 AM z3t0: Emil: yeah il keep google open
02:17 AM Emil: ascii art is the ultimate time wsster
02:18 AM Emil: I know :D
02:19 AM z3t0: hah yeah your site...
02:25 AM z3t0: are there some important avr software tools i should know about?
02:26 AM Casper: gcc-avr and avrdude are the main ones
02:45 AM enhering: z3t0: Make a good makefile too.
02:45 AM enhering: and automate all your tasks, like uploading, compiling, testing, pushing to repository etc.
02:46 AM enhering: Using a version control system is also good. I use mercurial. People prefer GIT. Other people prefer subversion.
03:09 AM Emil: It annoys me greatly that git is not really suitable for the version control I need
03:10 AM Emil: also git is dark magic
03:10 AM enhering: I like mercurial. Very simple
03:11 AM enhering: And I've been using XP-Dev successfully for years. Somehow I prefer it to GitHub and bitbucket
03:11 AM Emil: I need fast block level or even edit level version control
03:11 AM Casper: I need to learn version control one day
03:11 AM Casper: but not tonight for sure
03:11 AM enhering: not sure what it is
03:11 AM Casper: not at almost 4am
03:11 AM enhering: there is a good document on mercurial
03:12 AM enhering: Casper: http://mercurial.selenic.com/wiki/Tutorial
03:12 AM Casper: server not found
03:12 AM enhering: few commands do the magic
03:13 AM enhering: Maybe this is the same: https://www.mercurial-scm.org/wiki/Tutorial
03:14 AM enhering: Where are u, Casper ? Here is almost 5am
03:14 AM enhering: NE of Brazil
03:14 AM Casper: quebec, canada
03:14 AM Casper: where you would die of cold
03:14 AM enhering: Dreaming of migrating to Canada. Maybe soon.
03:14 AM Casper: it's currently -7°C
03:15 AM enhering: Here it is almost 30C all year
03:15 AM enhering: no winter.
03:15 AM Casper: if you do, do it in spring or summer, do NOT come here in febuary :D
03:15 AM enhering: Good advice
03:15 AM enhering: My target is Vancouver.
03:16 AM enhering: If I do not find a position in Switzerland, Canada I'll go.
03:16 AM Casper: winter can get quite cold, bellow -20°C, add wind and it's not fun... However, dealing with cold is way easier than heat
03:16 AM Casper: just add more layers
03:17 AM enhering: We've lived abroad. We manage cold well. Having only summer weather is kind of boring.
03:17 AM Casper: https://www.youtube.com/watch?v=b19GVosUjrM <=== that was last week, started snowing at 12pm, that was about 6:30pm, snowed like that for 14 hours or so...
03:17 AM Casper: we got 46cm of snow...
03:17 AM enhering: Nice! :)
03:18 AM Casper: yes, it's nice, except when they screwed up the cleaning on the highway...
03:18 AM enhering: I've lived in Stockholm for some time.
03:18 AM enhering: Cold weather makes people disciplined and organized.
03:19 AM Casper: some heads are starting to fall...
03:19 AM Casper: they didn't cleaned the highway 13, result: 2 semitrailer got stuck, which blocked the cars behind for 10 hours...
03:19 AM Casper: the 2 semi refused to be towed
03:20 AM Casper: but I don't understand... the semi got stuck, but the towing succeded to get there...
03:21 AM Casper: also, if you come here and have a car, you may want to get a remote starter installed. you'll love it in winter :D
03:23 AM enhering: Lots of snow
03:23 AM enhering: amazing.
03:23 AM Casper: http://i.imgur.com/owZeA4s.jpg
03:23 AM enhering: You speak mostly french or english?
03:23 AM Casper: the snow had all melted...
03:23 AM Casper: here, french
03:24 AM Casper: elsewhere in the country: mostly english
03:24 AM Casper: quebec is almost a country within a country
03:24 AM enhering: We lived in france for tow years
03:24 AM enhering: two
03:25 AM enhering: nice place to live.
03:25 AM Casper: that snowstorm happened last tuesday
03:26 AM Casper: they still are cleaning the streets... (picking up the snow)
03:26 AM Casper: and yes, they do pick up the snow and dump it in some dump sites
03:26 AM Casper: because it take too much space on the street
03:26 AM enhering: NE of Brazil is only sun. Sun, sun, sun. You can feel the light pressure if you go out around lunch time.
03:27 AM * Haohmaru throws a bag of snow at enhering
03:27 AM enhering: Easy living. People get lazy. Politicians corrupt.
03:28 AM enhering: Haohmaru: Where are u from?
03:28 AM Haohmaru: bulgaria
03:28 AM Casper: I used to chat every days with someone from brazil
03:28 AM Casper: until she got a kid, then... no more time I guess
03:29 AM enhering: guess right. My daughter is 8 months old. No time for anything.
03:29 AM Haohmaru: pesky kids, they ruin everything
03:29 AM enhering: :)
03:29 AM enhering: We love them. But we get soooo tired...
03:30 AM enhering: Bulgaria is cold too?
03:30 AM Haohmaru: nah
03:30 AM Haohmaru: it's spring here
03:30 AM enhering: I want spring. Here I have only summer.
03:31 AM enhering: Hate summer! :)
03:31 AM Haohmaru: move to some place with four seasons
03:31 AM enhering: I'm planning to.
03:31 AM enhering: When somebody answers my calls for help, or accepts my applications.
03:31 AM enhering: Whatever comes first
03:31 AM Haohmaru: hm?
03:32 AM enhering: Searching for a position outside Brazil. Even another PhD is welcome now.
03:33 AM * enhering just killed a bug in the code.
03:37 AM Casper: MURDER!
03:37 AM enhering: IT deserved.
03:38 AM Haohmaru: i'm calling the cops
03:38 AM enhering: Nasty one.
03:38 AM Haohmaru: enhering u goin to jail, son
03:38 AM enhering: Hopefully with a working code
03:39 AM enhering: I just counted, Casper. I manage all my code with 5 mercurial commands
03:40 AM enhering: amazing. I switch off optimization and everything works. I switch it on, and I get only zeros from the sensors.
03:41 AM enhering: I'd like to have that kind of extra-sensorial power to know what part of the optimization is not optimizing
03:43 AM Casper: enhering: there is some command to make pseudo asm output
03:43 AM enhering: what can i do with that?
03:43 AM enhering: sorry for the ignorance
03:43 AM Casper: https://paste.pound-python.org/show/qNCNeIkkmof8iJucjY74/
03:44 AM Casper: that is the makefile I use
03:44 AM Emil: enhering: you can selectively optimise
03:44 AM Casper: the pseudo asm output is basically half way between the C code and binary
03:44 AM Casper: so you can read it and see what it actually do
03:44 AM enhering: hum...
03:44 AM Casper: and what it killed
03:46 AM enhering: I 'll google that
03:46 AM enhering: Tahnks
03:47 AM enhering: My makefile is a literal. A bit bigger. https://gist.github.com/enhering/faa8a85c621eec68f9ab21f810ac68a1
03:50 AM enhering: I'm including selective optimization now.
03:52 AM enhering: This is with selective optimization by file: https://gist.github.com/enhering/e71ffe4051678ec05234f0a18216f465
03:53 AM enhering: Sorry. too much info.
03:54 AM Haohmaru: i don't have a makefile
03:54 AM * Haohmaru so happy
03:55 AM enhering: You rely on other people's solutions, Haohmaru.
03:55 AM enhering: I prefer doing my own shit
03:55 AM enhering: Easier to clean
03:56 AM Haohmaru: then erase your OS and bitbang yer way to success
03:56 AM enhering: Not so deep...
03:56 AM enhering: Whenever possible, I do my own shit.
03:56 AM Haohmaru: so do i
03:57 AM Haohmaru: but makefiles.. are a horror
03:57 AM enhering: What does Haohmaru mean?
03:57 AM Casper: that's a name
03:58 AM Casper: and asiatic name usually mean nothing, like "john" dosen't mean anything special
03:58 AM enhering: makefiles are easier than seem. Just a tag: some dependencies and commands on the next line. You make tag and commands get executed.
03:58 AM Casper: nite
03:59 AM enhering: Which language is Haohmaru?
04:00 AM Haohmaru: hm?
04:00 AM Haohmaru: it's the name of a character from a game..
04:00 AM Haohmaru: japanese i think
04:01 AM enhering: Ah, ok.
04:04 AM enhering: There are lots of users in the channel list. Most are quiet. Or away.
04:10 AM Haohmaru: most animals in the forest are also quiet.. cuz..
04:13 AM enhering: Did not know the capital of Bulgaria was called Sofia. Same name as my daughter.
04:29 AM ribalda: Hi! is this this the right place to discuss a bug on avr-libc?
04:30 AM enhering: Probably.
04:30 AM ribalda: It is this one https://savannah.nongnu.org/bugs/?49972 regarding wdt for atxmega
04:30 AM enhering: Maybe.
04:31 AM ribalda: I didnt get any response for almost three months now
04:32 AM enhering: I know someone on #sparkfun who plays with ATxmega. Try Erlend^SE
04:32 AM Haohmaru: i play with xmegas too.. i think his issues is with avr-libc
04:32 AM ribalda: I think the bug is pretty much contained and fixed with the patch I added to the bug. but seems to be no interest in upstreaming it
05:15 AM Emil: ribalda: avr software is in a bit of "lol lets do nothing" state for some reason
05:21 AM ribalda: Emil: too bad :(
05:27 AM Emil: ikr
05:31 AM Emil: Imho we should just set up a git of the components that seem stale
05:35 AM enhering: Can it be related to Atmel acquisition?
05:36 AM Haohmaru: "microchip bought atmel?!? ABANDON SHIP!"
05:39 AM skz81: Abandon chip* even ^^
05:41 AM enhering: I have two modules that talk to each other via SPI using a SPI protocol I wrote. They successfully communicate if: Module A and SPIProtocol are compiled with optimization AND ModuleB and SPI Protocol are compiled without optimization.
05:41 AM enhering: Sooo weird.
05:50 AM ribalda: Now that I am here... are you aware of a bootloader supported by avrdude that is better than avr109. I just fried a board on the field because of the lack of checksum :S
05:51 AM Lambda_Aurigae: how can you fry a board because of lack of checksum?
05:51 AM Lambda_Aurigae: maybe upload the wrong code or damaged code but that shouldn't affect the bootloader at all.
05:52 AM Haohmaru: ribalda stk500..
05:53 AM Lambda_Aurigae: yes, there are some bootloaders that emulate the stk500 interface.
05:53 AM polprog: enhering: i guess you probably tested A and B with optimization disabled? it's not very useful on AVR
05:54 AM enhering: polprog: Does not work. Only in that condition.
05:55 AM enhering: SPIProtocol has both master and slave methods. I'm checking the master methods, as module b is SPI master
05:55 AM polprog: this is extremely weird :o can you reflash A as master and B as slave?
05:56 AM ribalda: Lambda_Aurigae: it is probably a bad design from my side. The avr starts a board (presses the power button)
05:56 AM enhering: nope, polprog . B is hardwired as master, as it needs a GPIO connected to slave SS.
05:56 AM ribalda: during an update some code was wrongly updated and the main app died
05:56 AM ribalda: so the board does not start on its own any more :)
05:57 AM Haohmaru: did you reflash it?
05:57 AM Lambda_Aurigae: does it still go into bootloader mode? what do you have to do to force it to bootloader mode?
05:57 AM ribalda: if I get access to the board I can press the button and update it,
05:58 AM polprog: enhering: how do you make one master and one slave? different source file or a variable value?
05:58 AM ribalda: it goes into bootloader mode, but the other cpu (the one with ethernet access) is not up
05:58 AM enhering: Different source files, polprog
05:58 AM ribalda: so i have no chance to update it without sending a technitian to open a case and press a button :)
05:58 AM enhering: But same SPI protocol.
05:59 AM Lambda_Aurigae: ribalda, so, looks like someone needs to send a tech to update it and test it before they leave.
05:59 AM Lambda_Aurigae: and take a spare board in case it has a hardware issue.
05:59 AM polprog: enhering: so i guess you have to dig in the master code... i'd also check the signals if you can.
06:00 AM polprog: to see if it's not malforming anything
06:00 AM * enhering digging...
06:00 AM enhering: thanks, polprog
06:00 AM polprog: do you use some constructions that could be broken by optimization?
06:00 AM enhering: dunno
06:01 AM polprog: you can post the code of you want
06:01 AM polprog: if*
06:01 AM enhering: www.labvant.com
06:01 AM enhering: There is acces to the repo there.
06:02 AM ribalda: Haohmaru: any good place to download it? just google it or there is a good version ;)
06:02 AM ribalda: Haohmaru: any good place to download it? just google it or there is a good version ;)
06:02 AM Haohmaru: ribalda no idea
06:02 AM ribalda: (sorry for the dup)
06:02 AM enhering: firmware/src/classes/modules/COM.cpp
06:02 AM enhering: firmware/src/classes/modules/AMGP..cpp
06:03 AM enhering: firmware/src/classes/Protocols/SPIProtocol.cpp
06:03 AM enhering: There is some info on the project here: https://hackaday.io/project/11724-yauvc-yet-another-unmanned-vehicle-controller
06:04 AM enhering: COM module is the one who calls all the other modules to receive/send data. He is the master SPI
06:05 AM enhering: AMGP is a sensor module. Reads and sensors, calculate statistics and get data ready for delivery when called
06:05 AM enhering: Sorry. reads sensors
06:05 AM enhering: Sorry for the flood
06:06 AM polprog: i must say that's the bigget avr code repo ive seen
06:06 AM enhering: There are bigger ones...
06:06 AM enhering: It has code for many modules.
06:07 AM polprog: my biggest source was 10 something methods ;) i'll se if i spot something
06:07 AM enhering: If you have patience...
06:07 AM enhering: Thanks a lot.
06:08 AM enhering: SPIProtocol is a big complex. It can send multi byte data between two microcontrollers
06:08 AM enhering: big=bit
06:10 AM polprog: well, i guess i'm not much of help here since my SPI handling method was just sending bytes and receiving them...
06:10 AM enhering: No worries.
06:10 AM enhering: Thanks anyway
06:10 AM enhering: This protocol is open. May be useful if u need
06:11 AM enhering: The whole thing is open, indeed
06:11 AM polprog: Awesome project by the way !
06:11 AM enhering: Even PCBs are there.
06:11 AM enhering: Thanks
06:11 AM enhering: If you want you can make a module for it.
06:12 AM enhering: As carabia suggested on #sparkfun, we can make our own flying toilets.
06:13 AM polprog: looking at the project size, do you have an oscilloscope with which you could check the signals? like OSI layer 1 troubleshooting?
06:14 AM enhering: Nope... Waiting for a LA to arrive from china and deciding on which scope to buy. Brazil gladly adds 60% taxes over the price, by the way.
06:14 AM enhering: But we have the sun, at the the beaches...
06:15 AM polprog: keysight recently released a cool scope
06:15 AM enhering: payable?
06:15 AM polprog: or if you want something cheaper i'd look at some rigols
06:16 AM polprog: keysight? it's quite expensive
06:16 AM enhering: I was thinking of a hantek DSO5102B
06:17 AM polprog: looks nice
06:18 AM polprog: i have a rigol 1054 and it's usable, but i miss some features
06:18 AM enhering: A friend brought a MSO5202B. It has LA integrated. It is also an option
06:18 AM polprog: for example the protocol decoding takes only the screen data
06:19 AM polprog: so if you happen to have half a bit outside the screen then it all goes crazy
06:19 AM enhering: ops. really?
06:19 AM enhering: Not worth the extra $100 then
06:20 AM polprog: yes but as far as i know it's only the 1054z. higher end rigols do not have that problem
06:20 AM enhering: I ordered a http://www.dx.com/p/148945
06:20 AM polprog: on the other hand it's the cheapest professional oscillosope on the market ;)
06:20 AM enhering: hope it works. But is it coming from Chine over a snail.
06:20 AM polprog: and it's 4 channel
06:22 AM polprog: that LA looks cool, and the price is payable. >10$ for 24Mhz LA.
06:27 AM enhering: Yep. I ordered it in january...
06:28 AM enhering: People bring stuff on their backs, while they walk from china to brazil.
06:32 AM enhering: polprog. if you get interested in the controller project, you can join #labvant.com
06:32 AM enhering: No commitments. Just exchange ideas or suggest stuff.
06:38 AM enhering: https://pt.aliexpress.com/item/DDS-Function-Signal-Generator-Module-DIY-Kit-Signal-Sine-Square-Sawtooth-Triangle-Wave-DIY-Parts-Source/32604830044.html?spm=2114.10010308.1000016.1.KdCSeL&isOrigTitle=true
06:38 AM enhering: https://pt.aliexpress.com/item/DP30V3A-Upgraded-version-DPS3003-Constant-Voltage-volt-current-Step-down-Programmable-DC-supply-power-modele-converter/32685024785.html?spm=2114.10010308.1000016.1.kswxeu&isOrigTitle=true
08:48 AM julius___ is now known as julius_
08:57 AM JanC is now known as Guest30327
08:57 AM JanC_ is now known as JanC
09:19 AM rue_house: they ran into the same problem
09:19 AM rue_house: there are no cheap dacs
09:19 AM rue_house: so they made a 10k/20k R-2R ladder, 8 bit
09:20 AM inductiv- is now known as inductiveload
09:40 AM Arlenx: hi, i'm trying to add this library: https://github.com/electronut/attiny85-mma7660/tree/master/attiny85-mma7660-AS/attiny85-mma7660-AS to my attiny85 project.it include "i2cmaster.h" and "i2cmaster.S". after i opened a new project i add these files to my project, add include <avr/delay> set F_CPU to 8000000UL and get error on compile.any idea why?
10:08 AM Arlenx: i started a new same project but this time with c extension and not cpp, and it works.
10:18 AM skz81: Arlenx, what error ?
10:19 AM Arlenx: skz81, it's fixed now, it was on cpp project and when i start a new project with "c" it solved the problem
10:20 AM Arlenx: not sure why it fixed it
10:20 AM skz81: That's why I ask...
10:20 AM Arlenx: i can try to reproduce the error again. wait please
10:22 AM skz81: Arlenx, nervermind, I figured out
10:22 AM Arlenx: skz81, here all my errors: http://pastebin.com/SCWQeZRb
10:22 AM skz81: If you want include I2Cmaster.h from .cpp file
10:23 AM Arlenx: yep i want
10:23 AM skz81: use :
10:23 AM skz81: extern "C" {
10:23 AM skz81: #include "I2Cmaster.h"
10:23 AM skz81: }
10:23 AM Arlenx: oh
10:23 AM darsie: Looks like I broke two atmegas. The wall wart leaks 85 V AC and when I connected the parallel port of the PC to program with avrdude probably the PB4 pin and a parport pin died. avrdude can connect to the uC only rarely any more. PB4 is also used in high voltage/parallel programming, so the chips are junk, right?
10:23 AM Arlenx: very cool, thanks
10:24 AM darsie: The installed program still runs, but it's not useful.
10:24 AM skz81: Because in C++ function name are "Mangelized" (it mean that the prototype can be deduced from the symbol name)
10:24 AM Arlenx: skz81, yep it did the trick,thanks a lot
10:25 AM skz81: So if the symbols are compiled in C or ASM, you have to tell the compile "don't mangelize that". It should be in the header file, though
10:25 AM skz81: tell the compiler*
10:26 AM Arlenx: i think i wouldn't figure it by myself ever
10:28 AM skz81: Arlenx, kindof tricky I admit :) But very logical, when you think the same function can have different prototypes in C++ => it CAN'T be the same symbol in the binary object
10:28 AM skz81: Arlenx, by the way, what does produce such an output ? I mean the error you pasted ?
10:29 AM skz81: Atmel Studio or such ?
10:29 AM Arlenx: yep Atmel studio 7
10:47 AM JanC_ is now known as JanC
11:25 AM Emil: Didnt the multiple prototype thing come to C in the newest release of GCC; too?
11:26 AM Emil: One can also "simulate it" quite easily
12:07 PM Arlenx: does someone know some I2C lcd library 1602 for Attiny85 but without the need to include "arduino.h"? i know there is a library called LiquidCrystal but it using arduino.h and i don't want it.help please
12:12 PM Lambda_Aurigae: check with Jartza....he might know of or have one.
12:12 PM Lambda_Aurigae: I don't do much with the tiny85 as it has odd peripherals.
12:16 PM Arlenx: Lambda_Aurigae, ok thanks
12:16 PM Lambda_Aurigae: if it were for a mega I would say peter fleury's i2c lib is good and usable.
12:16 PM Lambda_Aurigae: don't think that would port to a tiny unless it has hardware i2c(twi) port
12:16 PM Arlenx: i saw it but i think he use arduin.h
12:16 PM Lambda_Aurigae: I have used fleury's i2c and lcd libs, combined, to make my own i2c interfaced 16x2 lcd displays.
12:17 PM Lambda_Aurigae: fleury is waaaay pre ardweeny crap.
12:23 PM Lambda_Aurigae: http://homepage.hispeed.ch/peterfleury/avr-software.html
12:23 PM Lambda_Aurigae: fleury's stuff is circa 2006
12:24 PM polprog: i love that spinning floppy clip art
12:24 PM Lambda_Aurigae: hmmm..I guess ardweeny started in 2003.
12:24 PM Lambda_Aurigae: at least, the pre-stuff like the wiring library which is just horrid.
12:25 PM Lambda_Aurigae: but, still, fleury doesn't use anything arduino in his code on that page.
12:47 PM Arlenx: Lambda_Aurigae, great, i must try it on attiny85.i'll try that lcd library and see if it works
01:34 PM Emil: I should get to writing my own i2c lib
01:34 PM Emil: It's just cancer that's all
01:50 PM polprog: dumb question: what's the proper #define F_CPU value for a bare atmega8? where can i find that?
02:08 PM Emil: 1MHz
02:09 PM Emil: If div by 8 set
02:09 PM Emil: 8MHz otherwise
02:10 PM Emil: http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2486-8-bit-AVR-microcontroller-ATmega8_L_datasheet.pdf Calibrated Internal RC Oscillator
02:10 PM Emil: Page 30
02:11 PM Emil: Oh cool, it actually has multiple frequencies available
02:11 PM Emil: 1MHz is the default
02:38 PM Jartza: evening
02:38 PM Jartza: well the correct answer to polprog's question is "whatever you have set your CPU speed to"
02:38 PM Jartza: either via fuses, or using oscillator/crystal or internal PLL
02:50 PM Emil: Yeah
02:54 PM polprog: yeah i know, i just wanted to make sure
03:06 PM polprog: weird, im getting 3.2V on an output of atmega 8. avrdude works correctly but the program doesnt... faulty chip?
03:06 PM polprog: i checked everything
03:18 PM polprog: works on mega16
03:18 PM polprog: ...
03:19 PM Emil: Hmm
03:20 PM Emil: wasn't m8 the chip that was _heavily_ faked with arm :D
03:20 PM Emil: Like everything bought from China was actually an arm
03:20 PM Emil: And a bad clone
03:21 PM polprog: avrdude says it's ok, i dont remember where i bought it
03:22 PM polprog: the other m8 works well in the thermometer
03:22 PM polprog: i remember some m8s were burned
03:22 PM polprog: this may be the one
03:23 PM polprog: this is really astonishing... the code is ok, avrdude says everythings cool.. and sudeenly bang 3V on output at vcc=5V
03:23 PM polprog: into the trash it goes
03:23 PM polprog: :D
03:23 PM polprog: good old m16 always works
03:26 PM Emil: :D
03:44 PM polprog: git commit -a and done for today :D
03:56 PM vishwin60 is now known as vishwin
03:58 PM bsdfox_ is now known as bobryan
03:58 PM akaWolf1 is now known as akaWolf
03:58 PM tchebb_ is now known as tchebb
04:00 PM Emil_ is now known as Emil
04:01 PM pwillard_ is now known as pwillard
04:08 PM grafi__ is now known as grafi_
04:55 PM julius___ is now known as julius_
05:19 PM hetii: Hello :)
05:20 PM hetii: Is a patern to use enum to describle all register and bits or better use oldstyle preprocessor macros ?
05:24 PM polprog: better use macros
05:29 PM hetii: polprog, you see now I work some driver library for se8r01 module, and for eg I have code there like: se8r01_write(WRITE_REG|iRF_BANK0_EN_AA, 0b00111111);
05:30 PM hetii: I think its not so fine to other people to wonder what`s the bits means
05:30 PM hetii: then everybody need to jump into datasheet and find proper table
05:30 PM polprog: in this case i think you should stick to avr libc convention
05:31 PM polprog: REG |= (1<<BITNAME)
05:31 PM polprog: btw that constructuon should be macro'd
05:31 PM polprog: its in my util.h
05:32 PM hetii: ok but what about the scope, let say that my driver use one header file that is included in project.and its often that if you have more such header some names can duplicate
05:33 PM Jartza: polprog: https://gist.github.com/Jartza/56d006504316ef5fe5a3db1b3e438ca9
05:33 PM Jartza: :)
05:34 PM hetii: so what`s, use namespace prefix for such case? some static typedef enum in c file
05:34 PM hetii: so what will be the best way to handle such issue.
05:35 PM polprog: as far as i know all bit names in avr core are unique
05:35 PM polprog: in my opinion a namespace is a good solution
05:36 PM Emil: polprog: use the define macros
05:36 PM Emil: sorry
05:36 PM Emil: hetii:
05:36 PM polprog: bear in mind that im not a c guru
05:36 PM Emil: hetii: do what polprog said
05:36 PM hetii: hmm
05:36 PM polprog: i dont even understand some of Jartza 's file
05:37 PM Emil: Sticking to the 1<<BITNAME defines is the best
05:37 PM polprog: ^^
05:37 PM polprog: use existing convention
05:38 PM Emil: hetii: if you need namespaces just do LIBNAME_DEFINE
05:39 PM hetii: hmm so you think that this is a bad idea: e http://paste.ubuntu.com/24217841/
05:39 PM Emil: Jartza: that file is absolutely disgusting :D
05:39 PM Emil: Absolutely haram
05:40 PM Emil: hetii: wtf is that stdio.h
05:40 PM Emil: if I see that anywhere into the trash the whole thing goes
05:40 PM Emil: :D
05:40 PM hetii: Emil, just example ...
05:40 PM Emil: What's P0?
05:41 PM Emil: As in, think carefully if you need to have your own namespace
05:41 PM Emil: they are still just numbers
05:41 PM hetii: Emil, its just name of bit for this ENAA register that I take from datasheet
05:42 PM polprog: Emil you can still define the bit numbets as variables :P
05:42 PM Emil: hetii: then it's good
05:43 PM Emil: hetii: yeah that paste seems reasonable
05:43 PM Emil: Though that ENAX typedef
05:43 PM Emil: thing escapes me
05:44 PM hetii: ENAX i use to see if gcc will complain some warning when I assign some value that is out of the declaration
05:44 PM hetii: but it`s not
05:44 PM hetii: so a bit odd for me .
05:46 PM Emil: That Jartzas paste is clever
05:48 PM Emil: hetii: remember that typedefs are evil
05:48 PM Emil: and make your code less readable
05:48 PM xentrac_: heh
05:49 PM Emil: And even less understandable
05:49 PM xentrac_: let's should just write directly in machine code! then we have no indirections to impede our understanding of what machine instructions will be generated
05:49 PM Emil: xentrac_: eh
05:50 PM Emil: that is still missing the cycle count information
05:50 PM polprog: whats the deal with that typedef? what does it do?
05:50 PM Emil: We need a meta language to describe that aspect
05:50 PM Emil: polprog: it's just an alias
05:50 PM xentrac_: heh
05:50 PM Emil: you could literally replace it with a sed command
05:51 PM polprog: it aliases uint8_t to uint8_t or what
05:51 PM Emil: struct long_name {things;}; typedef struct long_name short_name;
05:51 PM Emil: now instead of doing struct long_name x;
05:52 PM Emil: you can do short_name x;
05:52 PM Emil: It's literaelly stolen from the define macro :D
05:52 PM Emil: the naming is
05:52 PM Emil: typedef, type definition
05:53 PM Emil: now in hetiis example
05:53 PM Emil: we run into shorthand
05:53 PM Emil: you don't have to name your structs :D
05:54 PM polprog: that bit "variables" are clever
05:54 PM polprog: i need to read on that
05:54 PM Emil: but then accessing those structs must be either done through the variables you created
05:54 PM Emil: or by making a typedef that you can create them from
05:55 PM hetii: hmm
05:57 PM hetii: and what about using structure instead enum?
05:57 PM Jartza: Emil: well, what's wrong with those macros? :)
05:57 PM Jartza: I use them all the time
05:57 PM Emil: hm?
05:58 PM Emil: Jartza: dark magi
05:58 PM Emil: c
05:58 PM hetii: I could then define in structure address of register as well as all memmbers
05:58 PM Jartza: Emil: well. that dark magic makes the code itself much more readable :)
05:58 PM Emil: Jartza: bloody dark magic
05:58 PM Emil: MUSTAA MAGIAA
05:58 PM Jartza: and they also optimize well
05:58 PM Jartza: MUSTAA MAKKARAA
05:58 PM Jartza: wait, no
05:58 PM Emil: I know
06:02 PM hetii: hmm but as I can see the name of enum can be reused inside member list.
06:04 PM Emil: hetii: do not enum bitnumbers
06:04 PM Emil: define them
06:04 PM Emil: enum is for when you don't care about the actual number (also use the compile switch to select an 8 bit enum, otherwise they are 16 bits) but just to differentiate between them
06:05 PM Emil: enum is just a big fat automatic number selector
06:06 PM Emil: enum is just an automatic defime
06:07 PM hetii: so I don`t get it, first you said that my paste seems reasonable, and now you convince me to use old style define macros...
06:08 PM Emil: because I wasn't thinking straight
06:08 PM Emil: And was doing other things
06:08 PM Emil: don't use things just because they seem cool
06:09 PM Emil: stick to convention
06:09 PM Emil: define your bit numbers
06:09 PM Emil: define dem registers
06:09 PM Emil: What polprog said in the beginning ;)
06:11 PM polprog: i tested my light editor + makefile setup
06:11 PM Emil: I wish makefiles would just die
06:11 PM Emil: They are cancerous
06:11 PM polprog: make all and make flash
06:12 PM polprog: i was considering a bash script
06:12 PM polprog: but i didnt feel like it then
06:12 PM Jartza: just use my macros ;)
06:12 PM hetii: Emil, so you will like to see the macros like here: http://paste.ubuntu.com/24218034/ ?
06:13 PM Emil: Exactly
06:14 PM Emil: using enums like in that is not what they are used for
06:14 PM Emil: why you can still force values on enums is because sometimes someone has done stupid shit and you need to be compatible
06:14 PM hetii: hmm
06:14 PM Emil: Oh and
06:15 PM Emil: use (1<<BITNUMBER) notation
06:15 PM Emil: Much clearer, much better
06:15 PM hetii: and much more type
06:15 PM hetii: ...
06:15 PM Emil: lolwat
06:15 PM Emil: you typed them with your enum :D
06:16 PM Emil: https://emil.fi/jako/koodi/ping.c
06:16 PM hetii: ok but then in your final code you repeat ((1<<FOO)|(1<<BAR)) instead (FOO|BAR)
06:16 PM Emil: wat
06:16 PM Emil: Yeah sure
06:16 PM Emil: But you do realise
06:17 PM Emil: that you can also do #define ENAA_P0 1<<BITNUMBER
06:17 PM Emil: and then do ENAA_P0|something else
06:17 PM hetii: sure
06:18 PM Emil: I would replace the 0xparts with (1<<things)
06:19 PM polprog: yeah
06:19 PM hetii: but one things bother me with macros, when I have it I don`t see exactly with one bits belong to given register
06:19 PM hetii: by enum I can visually keep them in scope of register name
06:19 PM Emil: wat
06:20 PM polprog: MCUCSR |= (1<<PD0) would compule but it doesnt make sense
06:20 PM Emil: polprog: what do you mean doesn't make sense? :D
06:20 PM polprog: you can imply that you use bits that make sense :D
06:20 PM Emil: hetii: please explain what the heck do you mean by that?
06:23 PM hetii: Emil, ok I have some register called 'CONFIG' the bits name inside are called for eg, PRIM_RX, PWR_UP, when use macros I do`t see that those bits should be set just in "CONFIG" register
06:23 PM Emil: wa
06:23 PM Emil: t
06:23 PM Emil: And how does ENUM tell you that=
06:23 PM Emil: ?
06:25 PM polprog: wut? because you used them in the config scope they probably are from that reg. unless you are mcucr = (1<<PD0) type of programmer xD
06:25 PM hetii: Emil, http://paste.ubuntu.com/24218093/
06:25 PM Emil: polprog: really
06:26 PM Emil: polprog: I don't see your point with that piece of code
06:26 PM Emil: Oh you mean
06:26 PM Emil: that PD0 is not named in the context of mcucr
06:26 PM Emil: ah
06:26 PM Emil: I thought you meant that PD0 is the lowest bit
06:26 PM Emil: and and would just do mcucr=1
06:27 PM Emil: hetii: defines, fuck yeah
06:27 PM hetii: o_0
06:27 PM Emil: hetii: when you go below that part of the code, you will NOT see that config part anymore
06:27 PM Emil: seriously
06:28 PM Emil: you are stuck on "but enums are kewl :3 and I don't know how to use them but I think they are good here" part
06:28 PM Emil: Stop
06:28 PM Emil: Take the AVR route
06:28 PM Emil: polprog: yes, MCUCR=(1<<PD0) is stupid
06:28 PM Emil: (sometimes works)
06:31 PM Jartza: hetii: with my macros you could just say BITS_SET(CONFIG, PRIM_RX, PWR_UP);
06:31 PM Jartza: if I understood what you mean
06:32 PM Jartza: I think that's pretty clear
06:33 PM hetii: Jartza, I use your macros already few months :)
06:33 PM Jartza: :)
06:35 PM hetii: General what I try to do is library that will have different chip drivers, my idea is to have the code itself written in that way, that I could use to use it in other platform, like arm/avr etc..
06:36 PM hetii: I still all the time see that people repeat itself and wrote again the same driver for different platform.
06:36 PM Jartza: true
06:36 PM Lambda_Aurigae: because different platforms have different hardware and ways to interface to that hardware.
06:36 PM Jartza: probably needs an abstraction layer, which has nothing to do with enums
06:37 PM Lambda_Aurigae: Jartza, it's called arduino.....
06:37 PM Jartza: it's called bloat :)
06:37 PM Lambda_Aurigae: there are arduino builds for arm, avr, pic, esp8266, etc.
06:37 PM Lambda_Aurigae: bingo!
06:37 PM hetii: well... Arduino ..
06:38 PM hetii: I don`t know why but still cannot convince myself to use it
06:38 PM Lambda_Aurigae: every hardware/platform agnostic abstraction system I've ever seen is bloated to hell.
06:38 PM Lambda_Aurigae: hetii, I have trouble just spelling it correctly.
06:38 PM Lambda_Aurigae: my fingers want to type tarduino or ardweeny
06:39 PM Emil: Lambda_Aurigae: well, jartzas macros aren't overheard
06:40 PM hetii: yep ...
06:40 PM Emil: They do seem nice
06:40 PM Emil: but still
06:40 PM Emil: I'd stick to the defines
06:40 PM Lambda_Aurigae: but that's not a multiple platform hardware abstraction system.
06:41 PM Emil: That's true
06:41 PM hetii: So you see it, is it possible to create such library?
06:42 PM Emil: wat?
06:43 PM Jartza: yea my macros will not abstract platform
06:44 PM Jartza: but they can be extended to 32bit if needed
06:44 PM hetii: Emil, as I wrote I want to have one library with all possible ICs drivers that I could easly use on STM/AVR/LPC platforms :)
06:44 PM Emil: hetii: ifdefs. And a literal fuckton of them
06:44 PM Emil: It just makes code unreadable
06:45 PM Emil: better to just have the separate source files for different platforms
06:45 PM Jartza: or abstraction layer
06:45 PM Jartza: some kind of HAL
06:48 PM Jartza: still you need adaptation layer for each architecture
06:48 PM Jartza: which spells what Emil just said, fuckton of ifdefs
06:48 PM hetii: Jartza, of course, but you do it one time, and then connect all components from blocks
06:50 PM hetii: not easy topic, but this is something that I like to see, to finally reuse existing drivers without wasting time for adopting them again and again and again ...
06:50 PM darsie is now known as braindad
06:51 PM Jartza: well
06:51 PM Jartza: on ARM there is CMSIS
06:52 PM Jartza: and some manufacturers have made decent CMSIS implementation, others are just terrible
06:52 PM Jartza: then there is mbed
06:53 PM Jartza: which has become arduinowannabe for ARM
06:53 PM Jartza: and then there is arduino with gazillion ARM ports now
06:54 PM hetii: ok, but I think we should separate the host side part like avr/arm etc.. and a drivers for some modules, they I believe are static, you need to talk to them in the same way on most platform.
06:54 PM hetii: just the interface in between need to match
06:56 PM hetii: for eg, whatever if you use spi by using bitbang mode, polling or dma, the destination IC get the same data at the end of the day.
06:59 PM braindad is now known as darsie
07:13 PM hetii: ok time to sleep, thx for chat and see you some day :)
07:24 PM Lambda_Aurigae: Jartza, http://hackaday.com/2017/03/20/2017-hackaday-prize-begins-right-now/
07:25 PM Jartza: hmm
07:26 PM Lambda_Aurigae: you never did enter the OPV in anything that I saw.
07:27 PM Lambda_Aurigae: so it can be entered.
07:27 PM Jartza: hehe
07:27 PM Lambda_Aurigae: you create one of those hackaday pages and enter it.
07:28 PM Lambda_Aurigae: and you could win money just from getting likes on it.
07:28 PM Jartza: yeah, it was supposed to go to square inch but I never submitted it
07:28 PM Lambda_Aurigae: so,,,write it up and submit!
07:28 PM Lambda_Aurigae: final is in october...but get it in sometime in the next month and you have better chances of winning at least a little money.
07:30 PM Lambda_Aurigae: ok...10+ hour day at work...working on a migraine...so, off to bed...
07:32 PM Jartza: ouch, migraine sucks
07:34 PM Jartza: go and get better!
08:17 PM arij is now known as arij_work
08:30 PM arij_work is now known as arij
09:34 PM julius_: my code compiles with: while (1); { fadeLed(100); } but not if i remove the ; behind(1).....the ; looks wrong at that position
09:34 PM julius_: what is that?
09:36 PM julius_: ah ok...did copy a bad example of do...atomic. it did include a useless do statement
11:56 PM z3t0: hey!