#avr | Logs for 2016-07-29

Back
[05:37:57] <LeoNerd> https://www.tindie.com/products/leonerd/atmega328pb-development-board/ \o/ It's alive
[05:42:25] <Lambda_Aurigae> LeoNerd, chip on the bottom is a usb interface?
[05:46:31] <LeoNerd> CH340T, yup
[05:46:57] <LeoNerd> The T variant is a bit overkill, because it breaks out all the handshaking lines. But I couldn't find anything smaller/simpler that does DTR
[05:47:07] <LeoNerd> USB-UART bridges seem to either be TX/RX only, or -all- the HS lines
[05:47:32] <cehteh> no LC filter on AVCC?
[05:48:24] <cehteh> and some solder jumpers for handshaking lines tied to some gpios would be actually cool
[05:48:26] <LeoNerd> No.. I decided it wasn't a priority
[05:48:55] <LeoNerd> It's a small board, there's not a lot of space to put the LC. All it does is reduce a bit of noise on the ADC, and these sorts of experimental boards are hardly used for high-precision work
[05:49:07] <LeoNerd> Ooh that's a thought
[05:49:33] <LeoNerd> Might be hard pressed to squeeze it into the space though. I -may- have to go 4-layer at that rate
[05:49:51] <Lambda_Aurigae> I personally like something with a real ISP programmer integrated rather than doing the bootloader thing...but that's just me.
[05:50:04] <cehteh> look at the wattenrott board, the LC filter is tiny
[05:50:28] <cehteh> and when you want to safe space, ditch power/rx/tx leds!
[05:50:38] <cehteh> i hate those, more trouble than worth
[05:50:49] <LeoNerd> Lambda_Aurigae: mine has the ISP6 header of course
[05:50:49] <cehteh> one led on gpio for debugging is ok
[05:51:13] <LeoNerd> Yeah.. I might reconsider the TX/RX LEDs. The FTDI-based chips get away with it because the USB chip has dedicated control lines for them
[05:51:15] <cehteh> but they draw the most power
[05:51:22] <LeoNerd> But here I've literally just put the LEDs on PB0/PB1
[05:51:25] <LeoNerd> Er.. D
[05:51:37] <LeoNerd> So they're just active-low indicators for PD0 and PD1 anyway
[05:51:58] <cehteh> PWR is not hardwired to vcc?
[05:52:01] <cehteh> thats ok then
[05:52:26] <LeoNerd> PWR is yes. TX/RX are PD0/1 (active-low), LED is PB5 (active high)
[05:52:26] <cehteh> but actually one led would be enough, better leave the gpio free
[05:52:42] <cehteh> ditch PWR led
[05:53:13] <cehteh> PB5 .. ok thats pretty standard ,, rx/tx .. if one needs them he can add them
[05:53:31] <LeoNerd> Mmm.. that would save me quite a bit of routing space
[05:53:44] <LeoNerd> The traces for those LEDs are a right pain to route
[05:54:06] <cehteh> and in battery powered devices the PWR led sucks more than the rest
[05:54:23] <LeoNerd> Ohsure.. but do people actually use these thinsg in real devices?
[05:54:27] <cehteh> dunno what leds you use, but even if its only 5mA
[05:54:31] <LeoNerd> I always imagine just sticking them on a breadboard
[05:55:15] <LeoNerd> For development
[05:55:20] <cehteh> for once only production devices? .. solder them on a prototype board
[05:55:24] <LeoNerd> Hrm
[05:55:34] <cehteh> i did that for my epoxy oven
[05:55:50] <cehteh> will do for the next mold heaters too
[05:56:09] <cehteh> (need maybe 1-4,, too much trouble to design a PCB for that)
[05:56:31] <cehteh> ok not battery powered
[05:56:50] <cehteh> but over there in #arduino a lot people use them this way
[05:57:23] <cehteh> and i think its viable for personal devices with very low quantities
[06:10:40] <cehteh> LeoNerd: http://static3.watterott.com/20160022_1.jpg you see the inductor? :D .. and while at it, a 100nF to AREF would be nice to, that should be simple
[06:58:18] <LeoNerd> There is a cap on AREF
[06:58:25] <LeoNerd> It's on the back, where all the other discretes are
[06:59:37] <LeoNerd> Hm.. I don't see the inductor on that image
[07:00:02] <LeoNerd> Oooh is it that black 0805 next to pin 13?
[07:10:03] <LeoNerd> Actually thinking about it, my LEDs tied directly to PB0/PB1 are less useful than the true TX/RXLED support on the FTDI chip anyway
[07:10:21] <LeoNerd> The real LEDs have pulse-stretchers, whereas my direct ones don't. So it'd be hard to see faster data rates
[07:10:37] <LeoNerd> Soyeah I should probably just remove them.
[07:11:04] <LeoNerd> What I might do instead is some resistor-based hookup pads on the back to attach other handshaking lines to other GPIO pins
[08:51:12] <Palsson_> I don't know if we have any AVR assembly gurus here, but that would sure be helpful, i'm having two different hardwares, one that uses an assembly version of crc_ccitt_update and a new one that uses a c version. I don't have access right now to the old code so i can't test the algorithm with different values.
[08:51:30] <Palsson_> But can anyone see if these two are the same algorithm?
[08:51:31] <Palsson_> http://hastebin.com/qepevezuvu.avrasm
[08:51:47] <Palsson_> I got the one in C from here if that helps: http://www.nongnu.org/avr-libc/user-manual/group__util__crc.html
[08:53:26] <Palsson_> I get crc error right now and i don't know if it is because it's a different algorithm or not
[08:53:32] <rain1> they do seem different algorinthms
[08:53:40] <Palsson_> They do?
[08:53:41] <rain1> just because the constants in the asm are totally different
[08:53:52] <rain1> 111, 7, 15, ..
[08:54:03] <rain1> but in the C you have 8, 4, 3
[08:54:30] <rain1> you could try testing them on a few random inputs in a simulator maybe, see if they come out with same results
[08:55:40] <rain1> what about the rcall instruction in there? there's nothing equivalent to that in the C is there?
[08:58:51] <Palsson_> Yeah that one must have been added by the guy that did the old firmware i guess. Because that can't be part of the algorithm.
[09:01:47] <Palsson_> But it seems weird that those constants should be used somewhere
[09:01:56] <Palsson_> i mean, where should 111 be ?
[09:02:39] <Palsson_> The big issue is also that i'm running the C algorithm on a different hardware (stm32
[09:02:54] <Palsson_> So i can't use the same assembly
[09:25:59] <DKordic> Palsson_: That does not seem lika a valid assembly to me. How do You compile it?
[09:26:57] <Palsson_> DKordic it might be after compilation, it's from a lss file.
[09:27:06] <Palsson_> It's the only way i could get hold of it
[10:26:44] <carabia> does anyone know if theres those 240x320 lcd boards (2 4" - 2.8") with a broken out 4-bit sd bus
[10:27:32] <LeoNerd> SD bus?
[10:28:03] <carabia> yeah. sdio, though thats not really the proper name.
[10:28:16] <twnqx> actually that IS the proper name...
[10:28:30] * twnqx got the spec here
[10:28:59] <twnqx> SD Specifications
[10:28:59] <twnqx> Part E1
[10:28:59] <twnqx> SDIO Simplified Specification
[10:29:14] <carabia> i remember reading sdio refers to something else even though some silicon vendors use that name
[10:29:40] <twnqx> the technical comittee of the sd card association begs to differ :P
[10:29:54] <carabia> yes but it doesnt refer exactly to the 4bit bus, oslt. anyway semantics. dont get caught up with it
[10:30:50] <carabia> point being those lcd boards are often sold with a holder but only the 1 bit spi bus is broken out
[10:31:01] <twnqx> that much is true
[10:31:10] <carabia> im wondering if anyones seen a 4bit version
[10:31:12] <twnqx> If a card is a ‘Combo card’ (memory plus SDIO) then Full-Speed and 4-bit
[10:31:13] <twnqx> operation is mandatory for both the memory and SDIO portions of the card.
[10:31:13] <LeoNerd> I'm wondering why that relates to an LCD board
[10:31:31] <twnqx> the fact that most of the cheap LCD boards have an SD card holder, for whatever reason
[10:31:40] <twnqx> which is only broken out as SPI
[10:32:03] <carabia> yeah can we stop getting caught with the semantics no?
[10:32:20] <twnqx> nah :P
[10:32:23] <LeoNerd> Huh.. just, two unrelated functions bundled onto one board?
[10:32:27] <twnqx> yes
[10:32:40] <LeoNerd> I see that with RTC boards.. it's hard to buy a DS1307 board that doesn't have a 24C EEPROM bundled onto the same PCB
[10:32:46] <LeoNerd> Totally unrelated chip, just shares power + I²C bus
[10:33:33] <carabia> leonerd well... just the way it is. they are really cheap, relatively nice image quality
[10:34:21] <twnqx> carabia: i will agree though that you are partially right. sdio refers to the fact that there are IO cards (gps, wlan, modem, ...) in SD memory card formfactor. it just makes the 4 bit interface mandatory, hence why silicon vendors call it that, i guess. for the people who like to know such things.
[10:34:27] <carabia> usually its an ili driver for the lcd with either broken out separate spi for it or a 16bit if
[10:34:38] <twnqx> yeah
[10:34:43] <twnqx> i have a few of those, too
[10:35:06] <twnqx> in fact i haven't seen one without, for whatever reason
[10:35:18] <carabia> and a bundled reaistive touch screen driver (spi also) and an overlay
[10:35:27] <carabia> resistive*
[10:35:29] <twnqx> often, yes
[10:35:37] <twnqx> pretty nice combo for the cheap price :P
[10:35:49] <twnqx> i think the reason why they don't break them out is arduino :/
[10:36:57] <carabia> yeh. just interested in a 16bit one with 4b sd if. making a small arm board to fit under that. currently i got a board and ive soldered the 4b if straight from the leads but plug and play with headers would be so nice.
[10:37:10] <carabia> twnqx yeah.
[10:37:33] <LeoNerd> Thinking about it, I don't think I've ever seen an SD card socket with all pins on breakout -anyway-, even not attached to an LCD board
[10:37:48] <LeoNerd> All mine only have power, the regular SPI pins, and sometimes if I'm lucky, a cardsense
[10:38:04] <twnqx> the toy chips can't handle multibit anyway
[10:38:19] <carabia> i guess could be because afterall it is a proprietary interface
[10:38:23] <twnqx> what would an avr do with 100MB/s :P
[10:38:50] <carabia> well yeah and it clocks up to 48mhz
[10:38:55] <LeoNerd> twnqx: overheat?
[10:38:58] <twnqx> carabia: not sure.... it's pretty much standardized, and even the larger spi flash memories have 2bit/4bit, with jedec standardized commands
[10:39:39] <twnqx> well, standardized for highspeed memory cards, not IO
[10:39:50] <carabia> to commercially use it you should have association membership
[10:39:58] <twnqx> oh?
[10:40:04] <carabia> a few k a year
[10:40:06] <twnqx> admittedly, didn't read into that
[10:40:13] <carabia> 2000 usd iirc.
[10:40:18] <twnqx> cheap, compared to some
[10:40:22] <carabia> yes
[10:40:42] <carabia> anyway i gotta run. thanks anyway
[15:18:42] <LOMAS> hello.. I am reading around 60 2bytes of data from adc (taking 10 samples from 6 channels each time)..
[15:19:03] <LOMAS> I want to implement a filter .. either digital smooth or moving average
[15:19:25] <LOMAS> I am reading all data using ISR and I want to prcess the data in the main
[15:20:03] <LOMAS> is it better to use malloc/free in this case ?
[15:21:10] <LOMAS> like after reading all 60 data I will set a flag.. pass all the value via pointer and use digital smooth
[15:21:42] <LOMAS> is it risk free to create a 60 x 2bytes of array using malloc ?
[15:22:11] <LOMAS> or passing simply using pointer and doing the rest of the task is okay ?
[15:35:58] <cehteh> LOMAS: malloc/free is never a good idea
[15:36:17] <cehteh> and for moving average you dont need any extra memory
[15:36:37] <LOMAS> cehteh, oh oh.. found similar discussion in the freak's forum
[15:36:45] <LOMAS> and decided not to use them
[15:36:47] <cehteh> actually you can combine that with oversampling and get even better quality values AND save a costly division
[15:37:41] <cehteh> when startup sample lets say 16 values (averaging over 16) .. or read one and multiply that with 16.
[15:37:53] <LOMAS> oh.. requirement is not that precise .. its for sensing voltage level
[15:38:20] <LOMAS> so I am thinking to apply digital smooth or moving average
[15:38:28] <cehteh> later you just substract the old value/16 + a new sample
[15:38:30] <LOMAS> not used moving average yet
[15:38:44] <cehteh> still thats so simple to do that there is almost no excuse not to do it
[15:39:10] <LOMAS> okay..
[15:39:13] <cehteh> and for lipo for example 10bit resolutin are barely ok, bit better would be fine
[15:39:25] <LOMAS> what about putting all of them inside an ISR ?
[15:39:44] <LOMAS> not for lipo its for lead acid
[15:39:56] <LOMAS> being charged from solar pannel
[15:40:20] <cehteh> i'd do as minimal as possible in ISR .. generally
[15:40:42] <cehteh> but if you know its going to work when you do it there, then its ok and still its not very much to do anyway
[15:41:01] <LOMAS> so I am asking
[15:41:03] <LOMAS> :)
[15:41:37] <cehteh> depends on your program, if its not doing much more and nothing overly realtime critical then there is no problem
[15:42:07] <LOMAS> here is my ISR so far
[15:42:09] <LOMAS> http://hastebin.com/oqeqarufow.cs
[15:43:28] <LOMAS> there is not a big latency though ... I have no big exerience so not confident in inserting moving average in it
[15:44:06] <cehteh> http://git.pipapo.org/?p=battswitch.git;a=blob;f=src/battswitch.c some battery watchdog i did
[15:44:18] <sebus> cehteh LOMAS I just use simple arrays for each a/d and sampling them in isr, later I'll just do somewhere in code adc0=(ad0[0]+..+ad0[n])/(n+1) and got nice average
[15:44:27] <LOMAS> one more question: what is the main purpose of avoiding longer code in ISR, is it due to latency or the memory usages inside it ?
[15:44:31] <cehteh> sebus: why arrays?
[15:44:31] <sebus> malloc/free .. nah.
[15:44:44] <cehteh> when you want a lowpass then you dont need it
[15:44:57] <cehteh> one sum is all you need
[15:45:08] <LOMAS> no there are multiple channels
[15:45:18] <cehteh> well then one sum for each channel
[15:45:42] <cehteh> on my code above i have 2 channels too, one for voltage and one for current
[15:46:41] <LOMAS> cehteh, yes.. one sum for each channel
[15:47:15] <cehteh> but no array, only more complex digital filters need arrays
[15:47:26] <LOMAS> sebus, thanks for providing idea :)
[15:48:52] <LOMAS> cehteh, oh... okay. I have no confidience for that level of sophistication :)
[15:49:00] <LOMAS> okay with this. lol
[15:49:03] <cehteh> its dead simple
[15:49:13] <LOMAS> oh oh.. any reference then ?
[15:50:18] <cehteh> my code above or like i saied here, or some slight modification: at startup you read one sample, multiply it by your oversampling factor (16) and store that
[15:50:50] <LOMAS> okay.. I am looking at that
[15:51:01] <sebus> cehteh just it was somewhat easier for me (also, with nyquist s) also i'm not like "sample n times, check if done, then convert"
[15:51:03] <cehteh> later then value += new_reading - value/16; ...
[15:52:17] <cehteh> and all operations you do with value are *16 now .. so you have a range from 0..16368, not 0..1023
[15:52:32] <cehteh> and thats all
[15:52:46] <cehteh> of course you may change the '16' to some prefered factor
[15:52:53] <cehteh> powers of 2 are hany
[15:53:33] <LOMAS> oh oh
[15:53:35] <LOMAS> okay..
[15:54:01] <LOMAS> is it over-sampling (in software) ?
[15:54:37] <cehteh> kinda, simplified
[15:55:05] <LOMAS> I was thinking about increasing 10-bit to 12-bit provided by avr and was kinda scared to play with new registers ..
[15:55:07] <LOMAS> LOL
[15:55:09] <cehteh> AVR has a nice appnote about oversampling and decimation, which is somewhat more sophisticaed
[15:55:31] <cehteh> well if you want to do it right then its getting more complicated
[15:55:33] <LOMAS> oh yes.. I was exactly thinking about that :D
[15:55:43] <LOMAS> yeah.. thats true
[15:56:17] <cehteh> but this way is easy enough for a lot practical uses, almost as easy that you never not want to do it
[15:56:51] <LOMAS> yes.. I had no idea about this trick
[15:56:59] <LOMAS> lot easy
[15:57:19] <cehteh> bbl
[15:59:36] <LOMAS> okay cehteh thanks a lot :).. will let you know after I'm done
[15:59:53] <LOMAS> its 2 am in the morning .. time to go :D
[17:51:17] <carabia> hows it hanging
[17:53:13] <LeoNerd> Slowly
[17:53:43] * LeoNerd ponders connectors for 5V / 12V equipment power on the workbench
[17:53:46] <carabia> what are you working on?
[17:54:17] <LeoNerd> I have a growing amount of bench equipment that wants 5 or 12V
[17:54:24] <LeoNerd> So I'm just putting a big SMPS in a case with lots of sockts
[17:54:29] <carabia> such as?
[17:55:12] <LeoNerd> LED surround on extractor fan. Lots of little tester tools - continuity probe, low-range milliohmeter,...
[17:56:19] <LeoNerd> I could just use a big bank of 5.5x2.1s...
[17:56:54] <cehteh> LeoNerd: i am going to use XT60 everywhere
[17:57:06] <Lambda_Aurigae> spring terminals!
[17:57:21] <carabia> id probably go with something simple and easily replaceable. like abikos
[17:57:21] <LeoNerd> Euh :(
[17:57:31] <Lambda_Aurigae> or screw terminals.
[17:57:40] <LeoNerd> Eugh, also
[17:57:49] <cehteh> good old banana plugs :D
[17:57:53] <Lambda_Aurigae> just big springs like they used in the old radio shack electronics kits.
[17:57:53] <LeoNerd> No, I mean.. I want the big chunky thing to go from the PSU box into the wiring harness built onto the desk
[17:57:57] <LeoNerd> Ah, explicitly avoiding banans
[17:57:58] <carabia> meh. it gets wanky with screw terminals when you want to unplug
[17:58:09] <LeoNerd> bananas are on the experiment power supply, for actual experiment/development use
[17:58:16] <LeoNerd> This is purely utility power for equipment
[17:58:20] <LeoNerd> I want ot keep those separate
[17:58:31] <cehteh> well xt60 are keyed for polarity, they are cheap and easy workable, and provides shitloads of power
[17:58:38] <LeoNerd> Mmmmm
[17:58:39] <cehteh> (if not enouh use xt90)
[17:58:44] <LeoNerd> They don't look too bad..
[17:58:54] <LeoNerd> Though, hrm.. am I likely to find a chassis-mounted one?
[17:59:00] <carabia> for 5-12v test equipment? hahah
[17:59:02] <Lambda_Aurigae> http://chuckleaduck.com/comic/tell-me-a-story/
[17:59:20] <cehteh> prolly not the best, there are always $$$$ hirschmanns you can throw on a problem :D
[17:59:37] <cehteh> hole, glue it in :D
[17:59:39] <carabia> they are bulky and at least here i cant get them from the cornershop
[17:59:51] <Lambda_Aurigae> JB Weld!
[17:59:52] <carabia> xt plugs that is
[18:00:10] <cehteh> bulky isnt that bad on many cases :D
[18:00:29] <cehteh> good grip, good current, and you can operate them in the dark
[18:00:49] <carabia> maybe from an rc store. since chinese lipos are shipped with xt plugs
[18:01:23] <cehteh> amazon has plenty clones, hobbyking, banggood and many other chinese outlets
[18:01:43] <carabia> seriously id want to know what kind of test equipment are you operating if you need to pull that many amps
[18:01:48] <cehteh> well i ordered some MPX yesterday
[18:01:58] <carabia> and i want to see that smps too, then
[18:02:01] <cehteh> but mostly because i need more pins
[18:03:41] <carabia> xts are bulky and unnecessary. id go with something thats more readily available if i have to replace it so i wouldnt have to resort to hacking it one night and it becoming a permanent solution cause i cant arse to order connectors from china
[18:04:01] <LeoNerd> http://www.ebay.co.uk/itm/201496658324
[18:04:02] <LeoNerd> maybe?
[18:04:20] <LeoNerd> Nicely stable-looking.. chassis mountable
[18:04:25] <cehteh> This listing (201496658324) has been removed, or this item isn't available.
[18:04:33] <LeoNerd> .. ugh
[18:05:21] <LeoNerd> http://www.ebay.co.uk/itm/301718241599
[18:05:38] <carabia> as someone suggested... spring terminals would probably be most convenient
[18:05:55] <cehteh> ah yes, if you want them lockable and not that much power
[18:05:57] <LeoNerd> No, they're terrible. It's for a fixed item
[18:06:11] <LeoNerd> also springs are far too easy to miswire backwards :)
[18:06:19] <carabia> they are indeed not terrible
[18:06:36] <carabia> if its permanent why would you wire them backwards ever
[18:06:43] <LeoNerd> Uhm
[18:06:45] <LeoNerd> " - Insulation Resistance:Normal conditions no less than 1000 m Ω,Not less than 20 m Ω after the constant temperature test."
[18:06:48] <carabia> check once. forget.
[18:07:02] <LeoNerd> I hope the insulation is quite a good deal more than 20 milliohms ;)
[18:07:32] <cehteh> http://www.elektromodellflug.de/hochstrom-st.-bu..html
[18:08:14] <carabia> you cant really panel mount those
[18:08:31] <cehteh> you can, be creative :D
[18:08:38] <carabia> well... you can panel mount just about everything but... :)
[18:08:55] <cehteh> hotglue ftw :D
[18:09:06] <carabia> its just the wrong tool for this purpose
[18:09:16] <LeoNerd> I've panelmounted Molex KKs before
[18:09:54] <LeoNerd> They're quite easy.. you cut away a little part of the locator ribs, such that the remains of the rib holds it inside the cutout in the case preventing it from being pulled out forwards
[18:10:06] <LeoNerd> Then you can squeeze it in with a piece of blocking material behind it
[18:10:09] <LeoNerd> Friction fit :)
[18:10:15] <cehteh> srsly .. 2 holes in insulating material for the back contacts solder them ,slip them in, and then somehow fix them from the backside, even hotglue will work
[18:11:37] <carabia> im not sure hed spend this much time and thinking on this matter 7f he just wants to get some conns and hotglue them onto a wall
[18:11:56] <carabia> ... "srsly"
[18:12:46] <LeoNerd> Hmm.. what sort of current can you put through a 5.5x2.1 ?
[18:13:30] <LeoNerd> Hmm.. one socket here claiming 3A
[18:13:31] <carabia> leonerd bets the question though. if its permanent as you say, howd it be if you would just get a switch array on a panel and fix the wires permanently?
[18:13:50] <carabia> begs*
[18:13:54] <carabia> cause you seem to want it neat
[18:14:15] <carabia> just leave some room for expansion. few extra switches
[18:15:26] <LeoNerd> Hah.. actually these "aviation connectors" only claim 3A either
[18:15:59] <LeoNerd> The PSU itself is only rated to 4, so... eh; maybe just some 2.1mm sockets then
[18:17:14] <LeoNerd> Ohright I remember the other thing now... I wanted to find a way to distinguish 5V from 12V by using different connectors
[18:17:44] <LeoNerd> So maybe 2.1s for 12V and something smaller for 5V
[18:17:58] <LeoNerd> Or even USB
[18:19:57] <carabia> this is way too elaborate. bench engineering 101 folks
[18:34:37] <LeoNerd> Eh... fine; maybe I do it all at one plug size and just use standard coloured blobs of tape or something, to remember what's 5 and 12
[18:35:04] <LeoNerd> Seeing as I forgot that plan earlier and made myself some faceplates with two 5.5x2.1mm sockets + switches each anyway