#avr Logs

Sep 08 2017

#avr Calendar

12:21 AM thardin: so I imagine. but asserting DE just before any transmissions shouldn't be too hard to hack in
12:24 AM thardin: another thing is being able to reuse existing software on the host side
12:26 AM day__ is now known as daey
01:58 AM rue_house: 0xde?
02:00 AM Casper: 0xdeadcafe
02:02 AM rue_house: 0xdeadbeef?
02:02 AM rue_house: 0xbeefcafe?
02:03 AM rue_house: 0xcafe3141
02:03 AM rue_house: 0x8241
02:03 AM Casper: does 3141 have a signification?
02:04 AM rue_house: 31415926535?
02:04 AM Casper: *rewind*
02:04 AM Casper: does 3141 have a special signification?
02:04 AM rue_house: 31415926535?
02:05 AM Casper: https://www.longueuil.quebec/en/press-releases/2017/boil-water-advisory-sh-certain-sectors-of-vl-bo-sb <=== since yesterday :(
02:05 AM rue_house: 314159265358979323846264338327950288419716939937510582097494459230781640628
02:06 AM rue_house: 3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481
02:06 AM rue_house: ???
02:06 AM Casper: oh pie...
02:07 AM * rue_house rings the win bell
02:07 AM Casper: one digit too much or too little :D
02:08 AM Casper: now, find me something I should gift myself for my bday..
02:08 AM rue_house: /-\|/-\|
02:09 AM rue_house: https://www.aliexpress.com/item/1pcs-New-Arrival-USB-Logic-Analyze-24M-8CH-MCU-ARM-FPGA-DSP-debug-tool/1951913789.html
02:09 AM rue_house: ?
02:10 AM Casper: don't really need that, and too long for the shipping :D
02:10 AM Casper: so far, the only thing I can think of is a 450$CAD LCR meter...
02:10 AM rue_house: hmm I dont have much exciting on my list
02:11 AM Casper: ... I don't need that enought to even make it worth to gift it myself...
02:11 AM rue_house: why encite so much purpose?
02:13 AM Casper: ?
02:13 AM Casper: https://www.amazon.ca/Keysight-Technologies-U1731C-100Hz-Handheld/dp/B01D0QY9UM/ref=sr_1_33?s=industrial&ie=UTF8&qid=1504677742&sr=1-33
02:13 AM rue_house: why not just make it something that you can play with for a while
02:14 AM Casper: because I want precision, which is hard to do when you have imprecise parts
02:22 AM rue_house: damn, I gotta get my kernel dealt with
02:28 AM rue_house: its being circular
02:28 AM rue_house: when debian is bad, its bad
02:29 AM Haohmaru: what's wrong with it?
02:29 AM rue_house: cicular depandency
02:29 AM rue_house: apt is locked, so it wont do anything
02:29 AM rue_house: to install libc I need a new kernel
02:30 AM rue_house: to install the new kernel I need ramfstools
02:30 AM rue_house: to install ramfstools I need e2fsprogs
02:30 AM rue_house: to install e2fsprogs I need libc
02:31 AM Haohmaru: how did you get into such a situation!?
02:31 AM Haohmaru: were you naughty?
02:31 AM rue_house: I dont upgrade eery day
02:31 AM rue_house: which causes continious breakage and unhappyness
02:32 AM rue_house: I got for intermittent unhappyness
02:32 AM rue_house: which is now
02:32 AM Haohmaru: you had an old debian and you did not upgrade when the new version came out?
02:32 AM rue_house: I have to do terrible things to get this system 'fixed'
02:32 AM rue_house: thats right
02:32 AM rue_house: I like things working, so I dont upgrade
02:32 AM rue_house: which, occasionally, causes badness
02:32 AM rue_house: I have ways tho
02:33 AM Haohmaru: in my case, i installed the "newest" version (9) and so far it works too
02:34 AM Haohmaru: but i'm not too sure what to do with it in terms of upgrades
02:34 AM wirts-leg: yeah rue_house i agree with that point of view. new doesn't always mean better, and I don't make a habit of trying to fix something that isn't broken.
02:34 AM Haohmaru: what i do is use synaptic, and from time to time i use the "re-read package information" and then i select all packages for which there are new versions and install them
02:35 AM Casper: rue_house: I got even worse with gentoo
02:35 AM rue_house: my debian was installed in 2001
02:35 AM rue_house: its only ever had upgrades
02:35 AM Casper: A want B want C want D want A don't want E required by B
02:35 AM rue_house: same install
02:36 AM rue_house: I can break it, its just laborious
02:44 AM Casper: nite
02:45 AM rue_house: gnight
05:26 AM HelloShitty: polprog: you around now?
06:10 AM wirts-leg: Trying to make sense of this atmega168 ADC is kicking my butt tonight. reading one channel i can get to work fine, but trying to alternate between two of them is giving major issues. starting to wonder if some of this is my breadboards fault.
06:24 AM polprog: HelloShitty: yeah
06:24 AM polprog: what's up
06:27 AM HelloShitty: hi polprog
06:27 AM HelloShitty: I got the antenna annalyser code working
06:27 AM HelloShitty: I just need to replace the diodes I'm using because theu are not suitable for this applciation
06:27 AM HelloShitty: and I hope that that is the only problem now
06:28 AM HelloShitty: I think you were the one saying that you wouldn't be capable of doing such a thing, no?
06:28 AM HelloShitty: I just wanted to share that I think I made it
06:28 AM HelloShitty: at least the code is working
06:28 AM HelloShitty: and I can see some tiny values on the LCD module
06:29 AM polprog: i dont remember that priject, are you using the separate DSP?
06:35 AM Tom_itx is now known as Tom_L
06:41 AM Emil: polprog would never say you are not capable of doing somethibg
06:47 AM polprog: what im saying is that you cant measure any ham-frequency waveform with the avr's ADC because it's too slow
06:52 AM polprog: so you have to use that DSP
06:53 AM polprog: otherwise youre just getting garbage
06:53 AM LeoNerd: If you're only measuring *average* power, and you have the right sort of smoothing frontend on it, it should be fine
06:54 AM LeoNerd: I believe that's how these things work
06:55 AM polprog: it's a Standing Wave Ratio meter, meaning you simply measure the amplitude of the wave with a simple RF power meter. At least thats how you do it the analog way. you have a funny RF-voodo PCB which acts as a coupler, and you measure the coupled signal strengh.
06:56 AM polprog: somebody who is a ham or know that stuff please feel free to correct me
06:56 AM polprog: i have a vague idea about that stuff
06:58 AM Lambda_Aurigae: RF is black magic!
06:59 AM LeoNerd: Right; so yes if you're measuring the amplitude of a standing wave you'll be smoothing that to something (relatively) DC, that the ADC can cope with
06:59 AM polprog: most likely
07:00 AM polprog: i dont remember that project
07:00 AM polprog: but the guy just threw ina schem into that PDF without a word of explanation how it works
07:00 AM LeoNerd: Ahh
07:01 AM polprog: so unless you're the author of that schem or you know enough to make one yourself from scratch it's *useless*
07:01 AM polprog: and in the latter case you dont need the schem too, because you can make one yourself
07:01 AM polprog: that's the problem with publishing schematics on the net
07:02 AM polprog: i once saw somebody respond to a question about sharing the schematic, "I wont waste my time to give you something which you wont build or understand"
07:02 AM polprog: iirc that was some FPGA/mirco system.
07:03 AM polprog: it's not your 555 blinker you can assemble and it's not a pre-made kit
07:08 AM HelloShitty: polprog:
07:08 AM HelloShitty: sorry I got distracted in the meantime
07:09 AM HelloShitty: well, the link I followed is only using a DDS to generate a signal
07:09 AM HelloShitty: believe you
07:09 AM HelloShitty: but in this case I only tried to follow the instructions
07:11 AM polprog: if you get it working and it spits out sane reading, you're the man
07:11 AM polprog: but i used to be like that and i've met people who are like that... take a schematic from somewhere and try to make it
07:12 AM polprog: for example a girl in my class started to hang out with some guy from the tech school of EE, which is in the same building as my class, so we mix every day
07:12 AM HelloShitty: yeah
07:13 AM polprog: she wanted to find some common ground with him so she jumped into electronics
07:13 AM LeoNerd: Hurr hurr "common ground" >.>
07:13 AM polprog: one day we are having a casual chat and she shows me a schem of an FM radio
07:14 AM polprog: your usual one chip for the radio, and some micro fo control and display.
07:14 AM polprog: and she says, "i want to build it, any tips"
07:15 AM polprog: i looked at the schem, and i thought, "no way you gonna build it, you dont have the tools to assmeble that, let alone program the micro"
07:15 AM polprog: so i said, "that's a nice schem, what does it do?"
07:16 AM HelloShitty: she said "no idea, i got it on the internet!", no?
07:16 AM polprog: i suggested her to try something easier for starters, like a 555, a digital compass, you know your usual beginner stuff that i began with and that taught many people the basics
07:16 AM polprog: iirc she knew that it's an fm radio, but she got it from the serie of tubes
07:17 AM polprog: but she insisted she wants that radio
07:17 AM polprog: nevertheless..
07:17 AM HelloShitty: yeah, that sounds just like me, right?
07:17 AM HelloShitty: I also took this from some site
07:17 AM polprog: a month later i causally asked her what's up, adn she said she doesnt want the radio, it was too complicated, and they didnt manage to make it
07:18 AM polprog: honestly, i probably wount manage too, back then...
07:18 AM HelloShitty: and also digged a lot about the uC i'm using
07:18 AM polprog: but yeah. She jumped into the deep water, saw that it's too hard and it put her off.
07:19 AM polprog: i just see that you are heading to a similar situation
07:19 AM HelloShitty: yeah, well, I kind of know my limits
07:19 AM HelloShitty: which are quite short
07:19 AM HelloShitty: I know and admit it
07:20 AM HelloShitty: but this looked like to have some complexity for my knowledge but not too complex
07:20 AM HelloShitty: I build the wheastone bridge piror to building this
07:20 AM HelloShitty: and did some math to understand how the bridge was working
07:20 AM HelloShitty: also asked for help to understand some other points of the circuit
07:21 AM HelloShitty: because that circuit was more than just the bridge
07:21 AM HelloShitty: it also have peak detectors
07:21 AM HelloShitty: so I tried to get some basic knowledge about how the circuit did the work
07:21 AM HelloShitty: and only after that I started buildin this witth the OpAmps and the DDS
07:21 AM polprog: that's good
07:22 AM HelloShitty: of course I had some help
07:22 AM HelloShitty: I didn't figured out the whole circuit
07:22 AM HelloShitty: I didn't udnerstood very well what those diodes and caps were doing
07:22 AM HelloShitty: someone exlpained to me that those were peak detectors and explained me how did they worked
07:23 AM HelloShitty: despite the fact that I already should know them
07:23 AM HelloShitty: because learned about them in scholl
07:23 AM HelloShitty: school
07:23 AM HelloShitty: but they were placed in the middle of a bridge and I couldn't see them as peak detectors when I started looking to the circuit
07:24 AM HelloShitty: bt know I know how they work and I hase some basic knowldge about how the circuit works
07:24 AM HelloShitty: of course I can't tell you, with my eyes closed", right now what's the voltage at some point of the circuit
07:24 AM HelloShitty: but wirh some time, I do some math and I probabvly get there
07:25 AM HelloShitty: anyway
07:25 AM HelloShitty: bottom line is that I need to replace the diodes I'm using
07:25 AM HelloShitty: because they are not optimized to work with frequencies
07:25 AM HelloShitty: they are generic 4007
07:25 AM HelloShitty: and I need germanium diodes there becaue of the low voltages
07:26 AM LeoNerd: 1N4007? That's not really supposed to be a signal diode. It's intended for power rectification in PSUs
07:26 AM LeoNerd: High current, but low switching frequency
07:26 AM LeoNerd: Its internal capacitance will be terrible for anything RF
07:26 AM HelloShitty: after I get some of those, I'll test the circuit again and check what I get out to the LCD
07:26 AM polprog: id put shottkys there
07:26 AM HelloShitty: yeah
07:26 AM HelloShitty: germanium or shcotkys
07:26 AM LeoNerd: In fact, at very low signal voltages and high frequencies, a 1N4007 acts more like a capacitor :)
07:26 AM HelloShitty: the circuit I followed uses germanium
07:26 AM LeoNerd: An odd kind of voltage-dependent capacitor
07:27 AM polprog: anyway, you look like you wanna understand the circuit, and you have some "formal training" in the field :)
07:27 AM polprog: good
07:27 AM HelloShitty: I'm just an electrical engineering student
07:27 AM HelloShitty: at it's final year
07:27 AM polprog: good luck then ;)
07:27 AM HelloShitty: and never worked on the area
07:27 AM HelloShitty: so absolutely no knowledge
07:28 AM LeoNerd: Oh that reminds me: polprog have you seen the crazy non-transistor logic circuits that just use diodes?
07:28 AM LeoNerd: *Just* diodes
07:28 AM HelloShitty: so, in addtition to this
07:28 AM polprog: LeoNerd: no, im curious now
07:28 AM HelloShitty: either I add a bluetooth module to the mix to conteol this via smatphone
07:29 AM polprog: also, highlight me, im playing the old bordelands! :D
07:29 AM HelloShitty: or I just quit this project and start a new one that a firend of mine told me that could be interestinf
07:29 AM HelloShitty: interesting
07:29 AM HelloShitty: which is a filter analyser or a directional finder
07:29 AM LeoNerd: polprog: It relies on a certain property some diodes have, where the transfer characteristic has a slight backward curve to it. The circuit itself excites the diode at radio frequency to create this effect, then the signal works as a DC bias offsetting this, and the diode works like an inverter. From that you can put some resistor networks around it to make NOR or NAND gates, and the rest is built from there
07:30 AM LeoNerd: As a technology it's not very pracical for real stuff because the DC elements of it have to be kept quite slow; maybe tens of kHz at best as compared the RF excitation. But it's a great curiosity
07:30 AM polprog: woah
07:30 AM polprog: that's some high quality voodoo
07:30 AM LeoNerd: Yyyyup :)
07:30 AM LeoNerd: Some dude basically built a digital clock board out of it just to prove it works
07:30 AM LeoNerd: let me see if I can find
07:30 AM polprog: not suitable for a home grown "engineer" :DD
07:31 AM LeoNerd: Oh it's highly nontrivial indeed
07:31 AM LeoNerd: Every gate needs the various coupling caps and inductors around every single diode
07:31 AM LeoNerd: so yes, every logic gate needs *two* inductors
07:32 AM polprog: im sure it will comply to the FCC emission levels then xD
07:32 AM LeoNerd: Ssh <.<
07:32 AM LeoNerd: https://hackaday.io/project/11677-the-diode-clock here we go
07:33 AM HelloShitty: ok, if anyone is interested I can leave here the link to Github for the code I wrote for this to work!
07:33 AM polprog: windows 7 feels so weird
07:33 AM polprog: HelloShitty: sure go ahead. im curious myself
07:34 AM HelloShitty: https://github.com/PsySc0rpi0n/Project_Antenna_Analyser
07:34 AM polprog: LeoNerd: looks stylish as hell, like mix of USSr and fallout
07:35 AM LeoNerd: :)
07:35 AM polprog: i love it
07:36 AM HelloShitty: Any suggestions to improve my code, are welcome
07:37 AM HelloShitty: also, the sign_gen.c code was mostly copied from some example I found with minor adjustments
07:37 AM polprog: use PROGMEM to store strings, but that not critical
07:38 AM polprog: char tmp[BUFFER] could be a pointer, but im not that good at C to complain ;)
07:46 AM HelloShitty: ok, I'll look to that later
07:46 AM HelloShitty: thanks
07:46 AM HelloShitty: need to go now
07:50 AM daey: HelloShitty: i was always told to avoid float
07:51 AM daey: its not exact and afaik slow on avr hardware
07:51 AM polprog: use fixed point arithemtics
07:53 AM daey: lcd_puts("VSWR annalyser"); -> analyzer :p
08:01 AM LeoNerd: polprog: I've read this page again and I think I was wrong about the "reverse" part of the transfer curve. Looks like this actually works on the principle I suggested - that the diode looks a bit like a capacitor to RF, but its capacitance changes depending on the (DC) bias voltage acros it
08:02 AM LeoNerd: So in the circuit, the value capacitor has an effect on how well the charge pump works to generate an output voltage
08:05 AM polprog: interesting nonetheless
09:06 AM twnqx: i played with DTL logic once, also fun
09:07 AM LeoNerd: Eh; DTL is still fairly conventional though
09:07 AM LeoNerd: This is just outrigt weeeeeird
09:12 AM twnqx: yeah
09:12 AM twnqx: it's a design that just looks extremely complex
09:47 AM twnqx: LeoNerd: after reading through the project, i revise my statement.
09:47 AM twnqx: beautiful.
09:47 AM LeoNerd: :)
09:47 AM twnqx: bat shit insane, but beautiful.
09:47 AM LeoNerd: Indeed
12:22 PM HelloShitty: Hello again
12:22 PM HelloShitty: so I should use PROGMEM and don't use floats, is that it?
12:46 PM polprog: most likely yes
01:27 PM aczid: yeah don't use floats if you can avoid it
01:27 PM aczid: I noticed there is also __flash attribute to replace PROGMEM in recent GCCs but I haven't tried it
01:27 PM aczid: actually.. I didn't get it to work :)
02:20 PM Casper: HelloShitty: float are expensive
02:20 PM Casper: very expensive...
02:20 PM Casper: I made a fridge thermostat that use float for the NTC to °C
02:20 PM aczid: you will need all the floating point math code on board too, so your firmware size will explode with 1 float calculation in the code
02:21 PM Casper: I'm at 6.2k
02:21 PM Casper: and it don't do that much...
02:21 PM Casper: like float/float added 800 bytes or so of code
02:22 PM aczid: I think that's a pretty significant impact in size
02:22 PM HelloShitty: so what should I use instead of floats?
02:22 PM polprog: fixed pint, i told ya ;0
02:22 PM polprog: ;)
02:22 PM polprog: fixed point*
02:22 PM polprog: although i could use a pint
02:23 PM aczid: cheers :)
02:23 PM Casper: I couln't find much info on fixed point and it's support on avr
02:23 PM Casper: so I went with float
02:23 PM polprog: im out of root beer... :/
02:23 PM aczid: it's just integer math
02:23 PM HighInBC: the point is but an abstraction of the mind
02:24 PM aczid: set a scale, for example, measure money in cents rather than dollars, temperature in 10ths of degrees, etc
02:24 PM polprog: that's all when it comes to fixed point
02:24 PM Casper: but anyway, I needed log() too, so it was already an expensive piece of code
02:24 PM HighInBC: Do not try and bend the point. That's impossible. Then you'll see, that it is not the point that bends, it is only yourself.
02:25 PM polprog: wht do you mean
02:25 PM aczid: lots of algorithm optimizations I deal with in practice just come down to using different datatypes
02:25 PM aczid: I think that's a buddhist koan or something? :)
02:25 PM Casper: log(), 1/x, float/float :D
02:25 PM HighInBC: it is from the matrix
02:26 PM HighInBC: it was a spoon
02:26 PM HighInBC: I guess it is getting to be an old reference
02:26 PM aczid: I got matrix out of it :)
02:26 PM polprog: i had the feeling it was from matrix
02:26 PM aczid: I thought you got some original source for it
02:26 PM polprog: huh
02:26 PM polprog: ;)
02:43 PM HelloShitty: ahh the fixed point stuff
02:43 PM HelloShitty: I need to search about that
02:43 PM HelloShitty: don't know exactly how it's done
02:43 PM polprog: there's nothing to search
02:43 PM HelloShitty: I also need to search a bit nore about PROGMEM
02:44 PM HelloShitty: so, what type of data is a fixed point value?
02:44 PM polprog: if you need to precess 4.986 just process a (16 bit in this case) integer, 4986
02:45 PM polprog: so you are working on integers all the time
02:45 PM polprog: (because cpus like integers...)
02:45 PM aczid: integer arithmetic is much faster because it's simpler
02:46 PM aczid: you only lose precision at the most significant side
02:46 PM polprog: exactly
02:46 PM aczid: and define your own precision on the least significant side
02:46 PM aczid: being simpler also leads to smaller code
02:46 PM polprog: and it's faster
02:46 PM aczid: yes
02:47 PM aczid: seriously, don't do floating point on avr even if though you can :)
02:47 PM polprog: even if you are doing it on 32-bit integers it will probably be faster than floats, or, worse doubles
02:47 PM aczid: or any microcontroller really, if it doesn't have native instructions for floating point things
02:47 PM enh: can you make an integer PID?
02:47 PM polprog: PID?
02:47 PM aczid: a pid controller?
02:47 PM polprog: what's that
02:47 PM enh: yep
02:48 PM enh: can you make integer calculations for waypoints?
02:48 PM aczid: I do'n't know enough about them
02:48 PM enh: i want to use only integers
02:48 PM aczid: https://en.wikipedia.org/wiki/PID_controller
02:48 PM polprog: ah, i see. automatic control
02:48 PM enh: wait...
02:48 PM aczid: look at other PID controllers for MCUs :)
02:49 PM aczid: like open source drones etc
02:49 PM aczid: (that's where I learned what a PID is :))
02:50 PM enh: https://pastebin.com/KLtYwv3J
02:50 PM polprog: if you can implement a fixed point subroutines for logarhitms, integrals, and all the stuff i missed while peeking through the wikipedia page
02:50 PM polprog: you probably can
02:50 PM aczid: haven't gotten around to making my own though
02:50 PM enh: I have to search a solution for that
02:50 PM enh: It would be fine.
02:51 PM polprog: i have a book on automatic control... i shoulr read it
02:51 PM enh: We can make a channel library somewhere
02:51 PM enh: I have a few books
02:51 PM polprog: it's hardcover :P
02:51 PM polprog: and in polish
02:52 PM polprog: and it's a bit old
02:53 PM polprog: there are some great books on archive.org
02:53 PM polprog: last time i was browsing stuff about c64 programming
02:56 PM Casper: PID can be done with integer only
02:56 PM Casper: depending on the input and output
02:57 PM enh: have a lib on that, Casper?
02:57 PM enh: i have to go away now, but I ll be back later. enhering@gmail.com
02:57 PM Casper: like a thermostat, instead of working in degree, work in 1/1000 of degree so 23°C = 23000
02:57 PM Casper: I don't
02:58 PM Casper: then you get the target - setpoint in integer, and can then work the stuff with still enought precision
02:58 PM cehteh: me doing it that way too
02:59 PM aczid: I don't see any reason you couldn't make any floating point algorithm work with integer math
02:59 PM polprog: if you write the number handling code, you can even make that work with strings of roman numerals...
02:59 PM cehteh: there are some cases where floats are preferable, but they are rare
03:00 PM aczid: I wonder what those would be cen?
03:00 PM aczid: cehteh*
03:01 PM polprog: when doing waterborne drones. why did the programmer's boat sink? cos he used ints instead of floats! /s
03:01 PM Casper: I see this: Tset - Tactual... 20000 - 23000 = 3000, a +/-1°C would mean a 1000 = 100% so 3000/10 = 300% = 100% even if you lose the .x% precision it is not an issue
03:01 PM cehteh: good example would be time, when you need very precise time around now but can accept to become inprecise millions of years in past/future
03:02 PM polprog: i would not use floats for anything precise...
03:02 PM cehteh: and other statistical methods
03:02 PM polprog: rounding problems, you cant express some fractions as float
03:02 PM cehteh: by precise i dont mean exactness
03:03 PM cehteh: when you need high precision AND exactness things become hairy, that doesnt even work with normal integer math
03:03 PM polprog: im happy i dont have those problems...
03:04 PM cehteh: yep
03:04 PM aczid: haha, same
03:04 PM enh: I multiplied all integers by a thousando and did the math on them, but for the kalman data fusion the problem is more complicated
03:05 PM cehteh: i started some library for rationals some time ago, should test if its faster than floats
03:05 PM cehteh: enh: multiply by 1000 is a start, but not the complete solution, you have to account for overflows and look at the exact math you are doing
03:06 PM cehteh: and dont use kalman on avr's
03:06 PM cehteh: too slow
03:06 PM cehteh: just complementary filter and done
03:06 PM aczid: informative night on the chat! :)
03:06 PM polprog: indeed
04:12 PM HelloShitty: polprog: I'm not understanding something when changing my code to use Program Space instead of RAM
04:12 PM polprog: yeah. progmem
04:12 PM HelloShitty: I have already did the variables declaration to be stored in PROGMEM
04:12 PM polprog: basically you load the strings from the flash which is like a lot bigger than the ram.
04:12 PM HelloShitty: but how do I do to store some value into that variable?
04:13 PM polprog: you cant. it's only for initialized constants
04:13 PM HelloShitty: Hum, so yuo were only talking about strings?
04:13 PM polprog: like a hash lookup table, or a string
04:13 PM HelloShitty: ah ok
04:13 PM HelloShitty: because I have at least 2 variables which are arrays
04:13 PM HelloShitty: with 200 indexes
04:13 PM polprog: take a look at this: http://www.nongnu.org/avr-libc/user-manual/pgmspace.html
04:13 PM HelloShitty: I thought you were saying to put those on program space
04:14 PM HelloShitty: I'm reading http://www.atmel.com/webdoc/AVRLibcReferenceManual/pgmspace_1pgmspace_data.html
04:15 PM HelloShitty: So, it's useless for a variable like uint8_t var[200]; right?
04:15 PM polprog: look. RAM is read-write. flash is read only.
04:15 PM polprog: if you need to write to the variable you cant store it in flash
04:16 PM HelloShitty: ok
04:16 PM HelloShitty: thanks
04:37 PM HelloShitty: Well, I can't understand why my code is not working
04:37 PM HelloShitty: I think I did exactly like the link polprog gave me
04:37 PM HelloShitty: I'm going to update the code on Github
04:38 PM HelloShitty: it says it's ignoring the PROGMEM macro
04:39 PM HelloShitty: polprog: if you can take a look to my code and help me figuring out why it's not working, I would appreciate
04:39 PM HelloShitty: https://github.com/PsySc0rpi0n/Project_Antenna_Analyser/blob/master/project.c
04:39 PM HelloShitty: ah wait
04:39 PM HelloShitty: forgot an include
04:40 PM polprog: shouldnt the compiler tell you that?
04:40 PM HelloShitty: nahh, still not working
04:40 PM HelloShitty: it says it's ignoring the PROGMEM macro
04:41 PM HelloShitty: project.c:17:4: error: ‘__progmem__’ attribute ignored [-Werror=attributes]
04:41 PM HelloShitty: char msg_vswr_value[] PROGMEM = "VSWR Value:";
04:41 PM HelloShitty: this is what it says
04:41 PM polprog: that's very odd
04:42 PM HelloShitty: yeah, can't fifure out why
04:42 PM HelloShitty: figure*
04:42 PM HelloShitty: I did exactly the same as in the link you gave me
04:42 PM polprog: i think you need to make it global
04:42 PM HelloShitty: at least I think it's exactly the same
04:42 PM polprog: http://www.avrfreaks.net/forum/progmem-woes
04:43 PM HelloShitty: hum, ok
04:44 PM polprog: actually it is on the page :P "Let's say you have some global data:" they could have emphasize that a bit more, but yeah, careful reading
04:44 PM HelloShitty: ok
04:44 PM HelloShitty: thanks
04:44 PM polprog: np
04:46 PM HelloShitty: polprog: and there is something else
04:46 PM HelloShitty: in that link, they don't say that string_table needs to be const too
04:46 PM HelloShitty: but my compiler is complaining
04:48 PM HelloShitty: I also need to make that PGM_P string_table[] PROGMEM as a const
04:49 PM polprog: how is it complaining
04:49 PM HelloShitty: but that is weird
04:49 PM polprog: theres also another bug in your code that will show up in a moment
04:49 PM HelloShitty: I just checked the PGM_P macro and it' siimply a const char*
04:49 PM HelloShitty: -------------
04:49 PM HelloShitty: project.c:16:13: error: variable ‘messages’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
04:49 PM HelloShitty: const PGM_P messages[] PROGMEM = {
04:49 PM HelloShitty: ^
04:49 PM HelloShitty: <builtin>: recipe for target 'project.o' failed
04:49 PM HelloShitty: make: *** [project.o] Error 1
04:50 PM HelloShitty: -------------
04:50 PM polprog: gimme a sec
04:53 PM HelloShitty: ok
04:53 PM HelloShitty: I already tried to add 'const' before and after PGM_P
04:53 PM HelloShitty: but still didn't worked
04:53 PM HelloShitty: so, I'm not sure what's wrong
04:54 PM alx741: HelloShitty: 'messages' needs to be constant, not a constant pointer, as it's needed at compile time
04:55 PM polprog: that's odd since im testin it with the message string set as const and it's spitting out the same error
04:55 PM alx741: try defining it as something like `messages = "some string";" to see if the compiler still complains
04:57 PM polprog: hey!
04:57 PM polprog: it works!
04:57 PM HelloShitty: How it works?
04:58 PM polprog: https://puu.sh/xuOL3/e5bef42372.png
04:58 PM polprog: http://www.avrfreaks.net/comment/878806#comment-878806
04:59 PM polprog: it sounds stupid at first but it makes sense
04:59 PM polprog: constant pointer (in flash) to a constant string (in flash)
04:59 PM HelloShitty: hum, ok
05:00 PM HelloShitty: despite the fact theat documentation doesn't says anything about that
05:00 PM HelloShitty: I mean about the way it needs to be declared
05:00 PM polprog: yes, that's the problem... but that's what the forums are for
05:01 PM HelloShitty: sure
05:01 PM HelloShitty: thank you again
05:01 PM HelloShitty: polprog: I don't need to change anything in the compiling commad, do I?
05:02 PM polprog: look at the screenshot, it's the simplest compile command
05:02 PM polprog: no need to change stuff
05:03 PM HelloShitty: ok, thanks
05:03 PM HelloShitty: I already saw your screenshot
05:03 PM HelloShitty: just didn't noticed there was a command there visible
05:03 PM HelloShitty: I'll look again
05:03 PM polprog: ;)
05:04 PM HelloShitty: you don't use any flags in your compilation command
05:04 PM HelloShitty: heheh
05:04 PM HelloShitty: and the avrdude command will also be the same, right?
05:05 PM HelloShitty: no change needed to write data in program space
05:05 PM polprog: think about it for a moment
05:05 PM polprog: of course not, you are giving avrdude the flash image. it doesnt care about the contents as long as it's in the right format
05:06 PM HelloShitty: indeed
05:06 PM HelloShitty: ok
05:06 PM HelloShitty: thanks
05:07 PM HelloShitty: ouuchh
05:07 PM HelloShitty: code is not working after flashed it to the uC
05:07 PM HelloShitty: lol
05:07 PM HelloShitty: firstly printed some garbage, now, can't see anything in the LCD module
05:08 PM polprog: why arent you reading the docs, eh?
05:08 PM polprog: strcpy_P
05:08 PM HelloShitty: I'm not using that function
05:08 PM polprog: you should
05:08 PM polprog: you are seeing the 16-bit pointer, or rather, how the display interpreted it
05:08 PM HelloShitty: what for?
05:09 PM polprog: read on ;)
05:09 PM HelloShitty: ok
05:10 PM HelloShitty: This is non-sense for a small program like mine
05:10 PM HelloShitty: I need to write more code
05:10 PM HelloShitty: more complex because of 2 small char messages
05:10 PM polprog: maybe in this case it's a bit overkill indeed
05:10 PM HelloShitty: and also because the variable 'buffer'
05:10 PM HelloShitty: is on Data Space
05:11 PM HelloShitty: or whatever it's called
05:11 PM HelloShitty: so, why bother to store strings in Program Space, if later we need to copy them to Data Space to be able to use them?
05:11 PM HelloShitty: It's just for a matter of only accessing the strings when they are needed rather than having them in RAM all the time
05:12 PM polprog: beacuse you may have 1k worth of strings (i kid you not) and not that much ram available
05:12 PM HelloShitty: yeah, I got the point
05:12 PM Jartza: if you DO have lots of free RAM, it's faster to access them from there
05:12 PM Jartza: but if not... well
05:15 PM HelloShitty: I have experimented external RAM in the past
05:16 PM HelloShitty: I hace here yet a couple of external memory chips
05:16 PM HelloShitty: and I used SPI to save and load data from there Jartza
05:16 PM HelloShitty: so, if at any point I lack of RAM I can always add some complexity to the mix and increase RAM
05:17 PM polprog: it wount be as fast as internal ram, and you will have to write support procedures
05:17 PM polprog: you could always page ram
05:17 PM HelloShitty: yes, indeed
05:17 PM polprog: but that's hardcore...
05:17 PM HelloShitty: yeah
05:18 PM HelloShitty: one other question about that last function to copy strings from Program Space to Data Space
05:18 PM HelloShitty: wouldn't be wise to free that RAM after using the variable 'buffer'?
05:18 PM HelloShitty: otherwise it will be on RAM using space
05:18 PM polprog: you're not malloc()'ing it
05:19 PM polprog: should be freed after you exit it's scope
05:19 PM polprog: i believe
05:19 PM HelloShitty: ah yes
05:19 PM HelloShitty: well spotted, of course
05:25 PM polprog: i should make pinball for avrs
05:26 PM Lambda_Aurigae: AVRs don't roll very well..they are rectangular or square.
05:26 PM polprog: :D
05:26 PM polprog: allright.. sleep time
05:27 PM * polprog goes into noise reduction mode
06:36 PM enh: Lambda_Aurigae:
06:36 PM enh: Here?
06:36 PM Lambda_Aurigae: no
06:36 PM Lambda_Aurigae: I'm out camping
06:37 PM enh: Happy you
06:37 PM Lambda_Aurigae: jetpack and laptop...remoted into home computer.
06:37 PM enh: Found the bugS
06:37 PM Lambda_Aurigae: I didn't do it
06:37 PM Lambda_Aurigae: !
06:37 PM enh: :)
06:37 PM enh: None related to OOP.
06:38 PM enh: Two related to simple dumbness
06:38 PM enh: One to lack of memory
06:38 PM Lambda_Aurigae: oop should be oops
06:38 PM enh: Why the s?
06:38 PM Lambda_Aurigae: it's an English slang..Oops, I made a mistake.
06:39 PM enh: :)
06:39 PM Lambda_Aurigae: kept telling you there was a lack of memory.
06:39 PM enh: No things are working again. And I have a memory check implemented too.
06:40 PM enh: Thanks to all you guys who helped me
06:41 PM enh: cehteh, darling?
06:41 PM Lambda_Aurigae: sorry for being helpful...
06:42 PM enh: Its ok.
06:43 PM Lambda_Aurigae: I will make it a point not to be helpful in the future...makes me look bad.
06:43 PM Lambda_Aurigae: {:
06:43 PM enh: I 'll remember you.
06:44 PM cehteh: wtf :D
06:44 PM cehteh: good that it works but dont call me darling :D
06:44 PM Lambda_Aurigae: ok sweetie
06:45 PM cehteh: https://pbs.twimg.com/media/DJO66zUWAAIHzov.jpg:large /me having fun with setting up a new server here :D
06:45 PM enh: Sweetie, indeed, is better.
06:45 PM Lambda_Aurigae: needs more memory.
06:45 PM cehteh: grr
06:46 PM cehteh: Lambda_Aurigae: maxed out
06:46 PM Lambda_Aurigae: how much?
06:46 PM cehteh: 64G ECC
06:46 PM cehteh: ryzen 1700
06:46 PM Lambda_Aurigae: I'm working on getting a bunch of ram for my server/workstation.
06:46 PM Lambda_Aurigae: it maxes at 384GB
06:46 PM Lambda_Aurigae: 12 slots
06:46 PM cehteh: xeon?
06:46 PM Lambda_Aurigae: dual xeon
06:47 PM cehteh: i wanted something which doesnt need power like no more
06:47 PM cehteh: 24/7 on and eletricity is expensive here
06:47 PM Lambda_Aurigae: hehe
06:47 PM Lambda_Aurigae: then get rid of the spinning platters.
06:47 PM cehteh: was already expensive enough
06:47 PM Lambda_Aurigae: mine only has 6 drive slots.
06:48 PM cehteh: there are 2 SSD's already
06:48 PM Lambda_Aurigae: dual channel SAS drives...147GB 15Krpm drives in them.
06:48 PM Lambda_Aurigae: flippin flies
06:48 PM cehteh: but 32TB SSD is unobtanium
06:48 PM Lambda_Aurigae: only at 32GB of ram right now though.
06:48 PM Lambda_Aurigae: I have a line on some 32GB sticks to stuff into the 12 slots.
06:49 PM Lambda_Aurigae: have a raid5 with hot spare.
06:49 PM cehteh: i think that box will work pretty well for me
06:49 PM cehteh: will become raid6 here
06:49 PM Lambda_Aurigae: it's a dell poweredge t420 server.
06:49 PM Lambda_Aurigae: hardware raid caching controller with battery backup built in and 1GB cache.
06:49 PM cehteh: zfs
06:50 PM cehteh: well different setup :) but i just checking the new disks before i set everytihng up
06:50 PM Lambda_Aurigae: machine was free...I just added 3 drives at 120 dollars total.
06:50 PM cehteh: the didks there are pretty mixed with my old setup which i need to migrate
06:51 PM cehteh: hah
06:51 PM cehteh: ok
06:51 PM Lambda_Aurigae: and added a 1GB pciE16 video card
06:51 PM Lambda_Aurigae: which I had laying around.
06:51 PM Lambda_Aurigae: makes one hell of a workstation.
06:51 PM cehteh: i just payed 2500 Eur for cpu, ram, ssd's and 3 didks (and other small shit)
06:51 PM cehteh: thats more than enough
06:51 PM Lambda_Aurigae: daym.
06:51 PM enh: I'm spending around 30us between SS low and SS high on an AVR running at 8MHz on internal clock. Is this time typical?
06:51 PM Lambda_Aurigae: people give me computers all the time.
06:52 PM cehteh: case, PS an other things areretained
06:52 PM Lambda_Aurigae: they aren't bleeding edge but,,,a dual 3GHZ xeon rocks...beats out my i7 that I actually bought.
06:52 PM cehteh: getting computers isnt complicated, problem is that is never decent hardware
06:52 PM cehteh: i replaced a i5 which became unstable
06:53 PM Lambda_Aurigae: I have an hp DL380 gen7 dual xeon sitting in my workshop right now.
06:53 PM Lambda_Aurigae: has 12GB of ram in it and 6 notebook size dual channel sas 15Krpm 147GB drives.
06:53 PM Lambda_Aurigae: but it's waaay too loud for home use.
06:53 PM Lambda_Aurigae: and is rackmount
06:54 PM cehteh: hah yes
06:54 PM enh: Before getting a new computer I'd like to change my car. A ford Ka is too small when you have a baby.
06:54 PM cehteh: as you seen i build my new one very silent
06:54 PM enh: Have you guys tried putting the CPU into mineral oil? Does that thing work?
06:54 PM Lambda_Aurigae: it works.
06:54 PM Lambda_Aurigae: I haven't done it.
06:54 PM Lambda_Aurigae: no need.
06:55 PM cehteh: its to messy
06:55 PM enh: It seems so thermal efficient
06:55 PM Lambda_Aurigae: too
06:55 PM cehteh: if, then do it the old cray style with fluorinert waterfall
06:55 PM Lambda_Aurigae: I want one!
06:56 PM cehteh: https://en.wikipedia.org/wiki/Cray-2
06:56 PM Lambda_Aurigae: years ago I worked with a cray-2 that had one
06:56 PM enh: fluorinert is toooooo volatile. It will disappear in seconds
06:56 PM cehteh: that is cool
06:56 PM cehteh: nah
06:56 PM Lambda_Aurigae: USAF had a full size shuttle simulator at falcon airforce station.
06:56 PM Lambda_Aurigae: the cray2 was there to run that simulator.
06:57 PM enh: amazing toy
06:57 PM Lambda_Aurigae: I love that waterfall.
06:57 PM Lambda_Aurigae: I want one so bad.
06:57 PM Lambda_Aurigae: anyhow...gotta go be social for a while...out camping.
06:57 PM enh: good camping
07:09 PM enh: Major solar storm yesterday and today. Major earthquake in Mexico yesterday. Any similarity is a mere coincidence.
07:48 PM Lambda_Aurigae: we need a meteor shower with a few dozen impacts next!
07:49 PM enh: I hope a big one hits Brazil's capital: Brasilia.
07:51 PM Lambda_Aurigae: I was hoping more Buenos Aires so it's more like the movie version of Starship Troopers...
08:37 PM enh: cehteh, sweetie... How can I do sqrt using integers?
08:37 PM enh: Anybody knows?
08:37 PM cehteh: yes :)
08:38 PM Lambda_Aurigae: do the math.
08:38 PM cehteh: or do the google
08:38 PM cehteh: for small values i just do a loop
08:39 PM Lambda_Aurigae: https://en.wikipedia.org/wiki/Integer_square_root
08:41 PM enh: You said you were not going to be helpful again, Lambda_Aurigae.
08:41 PM Lambda_Aurigae: I'm not!
08:41 PM cehteh: int sq=0; int value=whatever; while( sq*sq <= value) ++sq;
08:41 PM Lambda_Aurigae: I'm just posting random google finds.
08:41 PM enh: ah, ok
08:41 PM cehteh: but thats expensive for biggier values
08:41 PM cehteh: and not exact
08:41 PM Lambda_Aurigae: expensive in time anyhow.
08:42 PM enh: I wonder if I'll be able to trust those values. They are used as variances of data and will be fed to the kalman filter
08:42 PM cehteh: well just example in reality you can use some binary search .. or what i posted is what i use for really small valies (<100)
08:43 PM cehteh: well i told you plenty times not to use a kalman filter :)
08:43 PM enh: I ignored it
08:43 PM enh: I need to fuse data.
08:43 PM cehteh: complementary filter!
08:43 PM cehteh: much much MUCH easier
08:43 PM enh: was ist das?
08:43 PM cehteh: and performs as well
08:44 PM cehteh: -> google :D
08:44 PM enh: I will.
08:44 PM cehteh: http://www.pieter-jan.com/node/11
08:44 PM cehteh: http://robottini.altervista.org/kalman-filter-vs-complementary-filter
08:45 PM cehteh: and most people use stm32 nowadays for this stuff and use floats :D
08:45 PM cehteh: there it is ok
08:45 PM cehteh: still the math works on integers as well, even easier
08:47 PM Lambda_Aurigae: I would be using an arm or a dspic for such things.
08:47 PM enh: Ok. We are not talking abut the same data fusion thing
08:48 PM enh: I may have two or three sensor modules plugged on the backplane.
08:48 PM cehteh: that is sensor fusion
08:48 PM enh: I want to fuse data coming from the same kind of sensor
08:49 PM cehteh: why that?
08:49 PM cehteh: i mean you can still use a complementary filter for that, but i dont understand why you want to do that
08:49 PM enh: the data that comes from the modules comes with average and variance over the last ten readings
08:50 PM enh: Higher variances must have lower priorities
08:50 PM cehteh: why?
08:50 PM enh: that is the base of kalman filtering
08:51 PM cehteh: that induces latency
08:51 PM enh: when the dispersion is bigger, the sensor is less precise
08:51 PM cehteh: or much better :D who can tell if there is some signal behind the noise
08:51 PM enh: if there is no signal behind the noise, the dispersion is bigger.
08:52 PM enh: https://pastebin.com/SaMzfrLV
08:52 PM cehteh: anyway i agree that you have to do some low-pass filtering
08:53 PM enh: This is different
08:53 PM cehteh: but the stuff is very critical that you add the least delay possible and only lowpass as much as you can handle
08:53 PM cehteh: averaging == lowpass
08:53 PM enh: this averaging is over the last fraction of a second.
08:53 PM enh: What I need from there is the variance
08:54 PM cehteh: do you do rolling averages?
08:54 PM enh: With the variances, this fusion gets the best of every sensor. And I do not need to care about it.
08:55 PM enh: https://pastebin.com/GPpA8MeY
08:55 PM cehteh: make it simple first. leave out most of this complex math and then see that you get the shit basically flying
08:55 PM enh: This is simple enough
08:57 PM enh: the algorithm is very simple. It finds which modules have sensors and which sensors with one call. Then it calls all the modules that have those sensors and fuse the data. I get the best possible results without caring for redundance
08:57 PM enh: It is amazingly simple for all that power.
08:59 PM cehteh: then just go on
09:00 PM enh: What I could do is normalize all the sensor data and multiply by a factor of ten. Work with all sensors on the same scale. Like -100 to 100.
09:10 PM enh: So...
09:11 PM enh: if I take sqrt(5) I get 2.2360
09:11 PM enh: the isqrt(5) would give me 2
09:12 PM enh: But I neet the information on the decimal places
09:12 PM Lambda_Aurigae: square root of 5 is 2 for sufficiently small values of 5 or sufficiently large values of 2.
09:12 PM Lambda_Aurigae: shift the decimal point over 2 or 3 places and do integer math.
09:12 PM enh: So I can multiply 5 by 100 and take the isqrt. What I get is 23
09:13 PM Lambda_Aurigae: that's how I do fixed point math on the avr.
09:13 PM enh: i need to shift it by an even power of 10
09:14 PM Lambda_Aurigae: there are even a couple of fixed point math libs out there.
09:14 PM enh: isqrt(500) = 23. Isqrt(5000) = 236
09:14 PM enh: if I shift 5 by an odd power of 10 it does not work
09:16 PM enh: Sorry. isqrt(5) = 2. isqrt(500) = 22; isqrt(50000) = 223; isqrt(5000000) = 2236
09:17 PM enh: isqrt(50) = 7
09:17 PM enh: isqrt(5000) = 70
09:17 PM Lambda_Aurigae: so square root doesn't quite work with that method.
09:17 PM Lambda_Aurigae: check out fixed point math libs.
09:17 PM enh: it works. But the multiplication factor must be an even power of 10
09:17 PM enh: I will.
09:18 PM Lambda_Aurigae: http://avrfix.sourceforge.net/
09:21 PM Lambda_Aurigae: https://ucexperiment.wordpress.com/2015/03/31/avr-gcc-fixed-point-vs-floating-point-comparison/
09:21 PM Lambda_Aurigae: http://www.procyonengineering.com/embedded/avr/avrlib/docs/html/group__fixedpt.html this one I have used in the past.
09:22 PM Lambda_Aurigae: but, alas, no square root in that.
09:26 PM enh: thx
09:29 PM Lambda_Aurigae: 1138
09:54 PM enh: Main module code: https://pastebin.com/XbUdnjBy
11:13 PM enh: Aamzing... I'm getting sensor telemetry...
11:51 PM JanC is now known as Guest88403
11:51 PM JanC_ is now known as JanC