#avr Logs

Feb 20 2018

#avr Calendar

12:00 AM polprog: heh the train rebooted. like all of it
12:03 AM nuxil: train hacked :p
12:04 AM polprog: all your trains are belong to us
12:10 AM nuxil: so i took a peek at the OL medal stats. since that all there is in the news atm. OL this OL dat.
12:11 AM nuxil: sweeden & finnland. wtf are you doing? sleep walking during the contests? :p
12:12 AM nuxil: polprog, do you watch OL ?
12:13 AM nuxil: *Olympics
12:14 AM nuxil: Its big thing in norway always been. i my slef dont care much tho.
12:27 AM polprog: not much
12:27 AM polprog: i wanted to watch ski jumping but they aired it when i was at school :/
12:28 AM nuxil: i wish skiflying was included in OL. thouse guys are fucking crazy. jumping like 230-250 Meters.
12:29 AM nuxil: thats like for the US people who dont know Meters. around 800ish feet :p
12:30 AM polprog: yeah
01:05 AM polprog: "today we will revise the if loop"
01:06 AM polprog: just kill me already
02:10 AM nuxil: dont worrie. you will die of bordom
02:38 AM Thrashbarg: "if loop" .... pardon?
02:39 AM Haohmaru: TOP: if (true) { goto TOP; }
02:40 AM Thrashbarg: sounds like BASIC
03:04 AM Emil: polprog: :DD
03:20 AM nuxil: so i need some help with spi stuff i quite don't understand.
03:21 AM nuxil: i got two leds flashing away when the main is running. when main is halted due to a isr. these leds will stop flashing ofc.
03:21 AM nuxil: now in the function SPI_SlaveReceive. if i read the value before the while statement the code will halt main forever. the leds no longer flash but the data is showing but lagging behind -1.
03:21 AM nuxil: if i read the "uint8_t data = SPDR0;" after the while loop, the code will no longer halt main forever but instead it will halt it when it gets a isr.
03:22 AM nuxil: i see the leds flash. then stop then it gets a isr. so it kind of looks good. but. when it receives it skips every 2nd number starting with the 1st one.
03:22 AM nuxil: so the sequence sent 0,1,2,3,4-9 looks like 1,3,5,7,9
03:22 AM nuxil: https://pastebin.com/E1rta3Z3
03:22 AM nuxil: test code on the receiving end.
03:23 AM nuxil: ideas ??
03:23 AM Haohmaru: y u call "lcd" functions from the ISR maaan :~(
03:24 AM nuxil: yea bad me :p
03:24 AM Haohmaru: in general, main() should NOT be blocked for too long
03:24 AM Haohmaru: or in other words, you should generally NOT spend any unnecesairy time inside ISRs
03:24 AM nuxil: but seen that the time bewteen each intement is 3sec. using lcd in the isr shouldnt be a problem right ?
03:25 AM nuxil: *increment
03:27 AM Haohmaru: what increments?
03:27 AM nuxil: the one sent on the spi bus. i have data sent starting from 0 going to 9. with 3 sec increment.
03:28 AM nuxil: and when it reaches 9. there is another 5 sec delay before it stars again.
03:28 AM nuxil: but.
03:29 AM nuxil: why does reading the SPDR0 before the while loop in the SPI_SlaveReceive function cause a it never to return to main. while reading it after the while loop it does.
03:30 AM Haohmaru: it looks very fishy
03:30 AM Haohmaru: you shouldn't normally have to poll a flag in an interrupt
03:31 AM Haohmaru: the interrupt should basically tell you that (for example) there's data for you available, and in the ISR you just go ahead and read it, then you return
03:31 AM nuxil: 217 in my manual
03:31 AM nuxil: has this exampple
03:31 AM nuxil: im using.,
03:31 AM Haohmaru: the example uses polling of a flag?
03:32 AM nuxil: yes. http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42743-ATmega324P_Datasheet.pdf 217
03:34 AM Haohmaru: uhm
03:34 AM Haohmaru: i only see a Transmit example there
03:34 AM nuxil: at bottom
03:34 AM Haohmaru: Master side transmit even
03:35 AM Haohmaru: but that's just the SlaveReceive() function
03:35 AM Haohmaru: that is an example of *blocking* reception
03:36 AM Haohmaru: so you took that and stuffed it inside the ISR - that's your problem
03:36 AM Haohmaru: if you want interrupt-based reception (which is typically better) then you have to write a slightly different version of the code
03:36 AM Haohmaru: specifically, don't use that example function because it's showing blocking reception
03:39 AM Emil: nuxil: you are debugging a slave device?
03:42 AM nuxil: yea. im tying ot figure out whats going on. its acting weird.
03:42 AM nohitzwork: if you read the data before the while loop the flag never gets set ? so remove the whole while and return "data"
03:42 AM Haohmaru: of course
03:44 AM nohitzwork: you get stuck in the while loop ?
03:44 AM Haohmaru: in the ISR
03:44 AM Haohmaru: could be somewhere else too
03:45 AM nuxil: nohitzwork, no its not stuck in the whileloop since its returning datashown on the display.
03:45 AM nohitzwork: ok
03:46 AM nohitzwork: well i would next do what Haohmaru suggested
03:48 AM nuxil: alright
03:48 AM Haohmaru: i've not done SPI slave, but i've done interrupt-based USART reception/transmition and synchronous USART master/slave
03:49 AM Haohmaru: you don't poll the interrupt flag from the interrupt ;P~
03:51 AM nuxil: gonna make more coffee then try that
03:52 AM Haohmaru: yes, MOAR coffee \o/
03:53 AM Thrashbarg: MOAR COFFEE
03:53 AM * Thrashbarg jitters
03:53 AM Haohmaru: buckets of coffee, silos of coffee, olympic-size swimming pools of COFFEE \o/
03:53 AM nohitzwork: yeah it seems like youre using blocking code solution inside ISR
03:53 AM nohitzwork: which makes no sense
03:55 AM nuxil: thats correct.
03:55 AM nuxil: the example in "SPI_SlaveReceive" in the datasheet is meant for main
03:55 AM nohitzwork: yeah
03:56 AM nuxil: now it ticks in sync :D
03:57 AM Haohmaru: yeeeeaaah \o/
03:57 AM Haohmaru: that deserves another bucket of coffee \o/
03:58 AM nuxil: i think so too. and a biscuit
03:58 AM Haohmaru: oh crap, i want biscuits too
03:59 AM Haohmaru: halp!
04:01 AM nohitzwork: https://electronics.stackexchange.com/questions/107146/avr-spi-slave-with-interrupt same problem
04:01 AM nohitzwork: and no correct answer
04:01 AM nuxil: :D
04:03 AM Haohmaru: the last one is closest to the truth
04:04 AM nohitzwork: yes
04:04 AM Haohmaru: as for the others who answered - they deserve their coffees to be taken away
04:04 AM Haohmaru: (and imma drink them secretly)
04:09 AM nuxil: :D
04:09 AM nuxil: repied to that post.
05:38 AM polprog: i think that first you do the while loop to wait till the received data is complete, most likely you reading it before and that causes thr flag to be reset. hence the lag
06:52 AM nuxil: polprog, yea. thats if you want to use it in main. but if you are using interrupt driven you dont want a while loop.
06:52 AM nuxil: sice the interrupt flag will trigger once the transfere is completete. no need to wait
06:56 AM polprog: oh yeah
06:56 AM polprog: my bad
07:05 AM Haohmaru: i think you haven't had ENOUGH... coffee
07:05 AM polprog: yes
07:06 AM polprog: first thing i do when im home
07:06 AM * Haohmaru pushes polprog into the coffee pool
07:06 AM polprog: <3
08:03 AM McDonaldsWiFi: on to a new idea.. solar powered attiny13
08:04 AM McDonaldsWiFi: what will this solar powered attiny do? good question. I dunno. :D
08:05 AM Haohmaru: dig bitcoins
08:05 AM cehteh: suncoins :)
08:07 AM dunz0r: McDonaldsWiFi: Let it store energy to shine an LED at night, so it can fill up it's solar charged batteries 100% of the time.
08:07 AM dunz0r: Infinite energy!
08:07 AM McDonaldsWiFi: xDD
08:08 AM McDonaldsWiFi: I thought bout having it send me some data during the day or something idk haha
08:08 AM _ami_: wow, much better performance with usb interrupt Endpoints as compare to bulk EPs in case of FS device.
08:08 AM McDonaldsWiFi: or just plot the sun or something
08:08 AM Haohmaru: or just patent it.. "solar powered attiny13" .. so no one else can use it ;P~
08:08 AM dunz0r: I have a bunch of Attiny85s that I don't know what to do with. I don't have a project suitable for them :/
08:08 AM dunz0r: Any ideas of a fun thing you can use one for? I want to use them for something.
08:09 AM dunz0r: I have considered building something like an annoyatron, but idk, it's very useable
08:09 AM _ami_: dunz0r: make a func generator using t85
08:09 AM dunz0r: Oh, that is a great idea actually.
08:10 AM _ami_: dunz0r: http://www.technoblogy.com/show?20W6
08:10 AM dunz0r: Hmm... or a really crappy synth
08:10 AM dunz0r: Nah, those are more fun with 4000-series logic circuits. :)
08:27 AM LeoNerd: I find 'tiny85s are useful as little one-function I²C attached modules for things you can't quite buy
08:27 AM LeoNerd: E.g. I²C attached PWM generator
08:27 AM dunz0r: Yeah, I don't have anything where I need it yet :)
08:28 AM * dunz0r had an idea
08:28 AM dunz0r: I could use one Attiny85 per nixie-tube... and have that control the bcd-to-nixie-decoding, instead of a shit ton of shiftregisters to an Atmega...
08:29 AM dunz0r: Over I²C... That would be pretty neat
08:29 AM LeoNerd: 'tiny85 doesn't have enough pins for that, surely?
08:29 AM LeoNerd: Once you've taken 2 out for I²C you've only got 3 left
08:29 AM dunz0r: Oh right. Darn it :/
08:30 AM LeoNerd: tiny84 might just
08:30 AM dunz0r: Yeah, but I don't have a tube of 10 of those :)
08:30 AM LeoNerd: I find that tiny85/84/841s become part of my jellybean parts supply
08:30 AM dunz0r: If I get rid of the reset pin though...
08:30 AM LeoNerd: Always good to have some on hand
08:31 AM LeoNerd: HVSP :)
08:31 AM dunz0r: Yeah, I have an AVR Dragon, so I can do it, not sure if I want to though lol
08:31 AM LeoNerd: If only you knew someone who'd made an HVSP programmer for this very reason *cough* https://www.tindie.com/products/leonerd/avr-hvsp-programming-bus-pirate-adapter/
08:31 AM McDonaldsWiFi: dunz0r: I made my wife a POV Wand with one!
08:31 AM LeoNerd: It's perfectly fine; I do it all the time
08:31 AM McDonaldsWiFi: Are HV programmer easy to DIY?
08:31 AM McDonaldsWiFi: if I wanted to convert the reset pin?
08:31 AM LeoNerd: Also sometimes you can arrange that the RESET pin is in a place on your circuit that will be fine at 12V, so you can do it "in-circuit"
08:32 AM LeoNerd: McDonaldsWiFi: Yeah; the hard part really is the software/driving it from PC
08:33 AM McDonaldsWiFi: guess it wouldn't be as easy as using an external tool lol
08:33 AM McDonaldsWiFi: in avr studio
08:33 AM LeoNerd: My programmer controller [which Iv'e yet to put on tindie] pretends to be an STK500
08:33 AM LeoNerd: So avrdude or AVR Studio or whatever shouldn't notice the difference
08:39 AM dunz0r: Hmm, apart from the fun of it, I don't really gain anything by using attiny85s for control instead of shift-registers for port expanding.
08:40 AM dunz0r: And it WILL look cooler with more ICs :)
08:40 AM LeoNerd: Hrm... 'tiny85 would *almost* make a handy I²C-UART bridge, except again not quite enough pins. Bidirectional I²C slaves could usually do with an interrupt pin
08:40 AM LeoNerd: tiny841 would be much easier - has a real I²C slave and UART module too
08:45 AM _ami_: LeoNerd: there are other cheaper options available for i2c slave. :) is USI realiable?
08:45 AM _ami_: e.g. http://amitesh-singh.github.io/stm32/2018/01/07/making-i2c-slave-using-stm32f103.html
08:46 AM LeoNerd: tiny841 has a real I²C slave module
08:46 AM _ami_: btw, stm32f1XX i2c has silicon bugs so beware! :)
08:46 AM LeoNerd: I'm also pretty sure the tiny841 is cheaper than an STM32
08:47 AM LeoNerd: 100 tiny841s in SOIC14 - £0.67 on mouser; I can't see any STM32F103s cheaper than £3 there
08:48 AM LeoNerd: The tiny841 is a lovely chip; it basically makes the tiny84 totally redundant now. I'm sure the latter only exists now for legacy reasons.
08:48 AM LeoNerd: It's the "tiny" version of the mega328pb in many ways
08:48 AM _ami_: thats nice. i did not get chance to play with t841
08:49 AM LeoNerd: 14pin SOIC. All 12 pins are ADC-capable. Two timers, 8+16bit. USI. Real I²C (slave-only) module. Two UARTs
08:49 AM LeoNerd: *TWO* UARTs on a tiny chip
08:50 AM _ami_: wow, thats nice. is it release after microchip takeover?
08:50 AM LeoNerd: And many of the peripherals have flexible routing - the OCnx pins aren't fixed
08:50 AM LeoNerd: So you can map the PWM outputs of timers to basically any pin that's free
08:50 AM LeoNerd: Oh, my mistake. Three timers - it has two 16bit ones
08:51 AM LeoNerd: It's a pre-Microchip release; but one of their last I think
08:51 AM _ami_: well, stm32f103 has 4 timers with 21 pwm pins outputs :)
08:52 AM LeoNerd: Wellsure, but that's also a big chip
08:52 AM LeoNerd: I usually find that I use ATtiny chips as secondary modules in a project - one ATmega at the centre doing the main logic, with some offloads onto ATtinys
08:52 AM LeoNerd: E.g. I have a DMX offload chip, that handles addressing and buffering and so on, presents a simple SPI interface
08:53 AM dunz0r: LeoNerd: I always thought of the 2313 as the 328 of the tinys
08:53 AM LeoNerd: Bah.. the 2313 is rubbish
08:53 AM LeoNerd: It has a UART, but no ADC, no USI/I²C/SPI,...
08:53 AM LeoNerd: It's really lacking in peripherals
08:54 AM McDonaldsWiFi: I've never actually used i2C
08:54 AM McDonaldsWiFi: O.o
08:54 AM LeoNerd: The 2313 is *basically* just a UART-GPIO expander chip. There's very little reason to use it
08:54 AM Haohmaru: i2c sux
08:54 AM dunz0r: LeoNerd: If you don't need ADC it's great
08:55 AM LeoNerd: Eh; I've just never really worked out what I'd use it for. Lacking any sort of synchronous serial bus, it's not really useful as a secondary slave chip in a multi-MCU project like I describe above
08:55 AM McDonaldsWiFi: 99% of my projects either need 8bit parallel or a quick serial bit bang
08:55 AM LeoNerd: At only 2Ki of flash, it really can't store enough program to do anything very interesting on its own; nor does it have many peripherals to do interesting things /with/
08:55 AM dunz0r: I've used it as the main µcu in some stuff I've built, it's great for when you just need an LCD, some buttons and some sort of output or something
08:56 AM LeoNerd: Ohwait my mistake; it does have USI
08:56 AM LeoNerd: OK so maybe it's not _quite_ as bad as I recall
08:56 AM LeoNerd: It'd probably make a decent I²C-attached GPIO expander if I needed slightly custom abilities, like PWM on a few pins
08:57 AM dunz0r: Yep, or if you don't need ADC :)
08:57 AM LeoNerd: I usually use a PCF8574 for front-panel LED/button attachment, but that has a couple of non-ideal properties
08:57 AM LeoNerd: It interrupts on both press -and- release, it has no change interrupt mask, and it can't PWM an output
08:58 AM dunz0r: And it's not an AVR :)
08:58 AM LeoNerd: Wellno, but it's so simple a chip that doesn't matter
08:58 AM LeoNerd: LEDs/buttons on an 8574 is basically the I²C version of putting LEDs on a 74'595
08:58 AM LeoNerd: Except you get read access and pinchange interrupt too :)
08:59 AM LeoNerd: Hrm... OK so the QFN packaged version of tin2313 is about £0.60 on mouser in small volume. That's comparable to many of the GPIO expanders *anyway*
08:59 AM LeoNerd: Maybe I should consider it
08:59 AM dunz0r: LeoNerd: The 4313 is available if one needs more memory as well
09:00 AM LeoNerd: True
09:00 AM LeoNerd: Perhaps I'll consider it for my front panel boarsd
09:00 AM LeoNerd: *boards
09:01 AM LeoNerd: Currently I'm using an 8574 for reading buttons and a rotary encoder, which is non-ideal because as I said, it registers press *and* release of all pins. You don't need that for both channels of rotary rotation
09:01 AM LeoNerd: Ideally I'd do a bit of frontend processing, to calculate rotation direction, also "long press" on buttons
09:01 AM dunz0r: Ah, with something like a 2313, you wouldn't have to :)
09:02 AM LeoNerd: Yup indeedy
09:02 AM LeoNerd: And some PWM'able outputs for LED fades
09:03 AM LeoNerd: I'm generally considering the idea of selling products with pre-programmed MCUs on Tindie.. such as my DMX offload board
09:11 AM dunz0r: Hmm, selling stuff on Tindie could be a fun experience.
09:12 AM LeoNerd: It's growing on me, definitely :)
09:13 AM LeoNerd: Prettymuch any new project these days usually hits a point of "I wonder if I could sell this?"
09:13 AM LeoNerd: E.g. my latest one, being my AVR programmer + target power
09:14 AM dunz0r: Yeah, and I usually end up with a lot more boards than I need anyway, since you can't just order one board, lol
09:14 AM LeoNerd: That was my original reason for selling my very first thing
09:15 AM LeoNerd: "Well I have this spare board" - that was my HVSP progammer
09:15 AM dunz0r: I have 10 spare boards, unfortunately a bloody pin out is the wrong way :D
09:15 AM dunz0r: It feels stupid to just throw them away lol
09:15 AM dunz0r: But otoh, they only work with some greenwiring and mounting stuff in weird places
09:16 AM LeoNerd: Hah.. oh I have a bag full of mistake boards
09:16 AM LeoNerd: It's hard to know what to do with those indeed
09:16 AM dunz0r: Not sure why I'm saving them. It's not like I can use them, but it feels stupid to just throw them away
09:16 AM Haohmaru: put them under the table foot so it doesn't wiggle!
09:16 AM LeoNerd: Yeah.. I dunno if there's enough worth in recycvling them
09:16 AM LeoNerd: Ooh.. one possible idea - can you cut them up to use them as board holders for solderpaste stencils?
09:17 AM LeoNerd: They're obviously the right thickness
09:17 AM dunz0r: LeoNerd: So, sold anything yet?:)
09:18 AM Emil: Hmm
09:18 AM Emil: Here's an idea
09:18 AM LeoNerd: Anything? I've sold so far 105 or so items, across 9 product types
09:18 AM rue_: dunz0r, thats where the value of making boards yourself comes in, you can do a 1-off and see if its right
09:18 AM Emil: using thin pcbs as stencils
09:18 AM dunz0r: LeoNerd: Cool!
09:18 AM LeoNerd: Emil: Waaaaay too thick. You want like... 3 to 5mil at most
09:18 AM dunz0r: rue_: Yeah, I usually do that, but didn't for that particular project.
09:19 AM LeoNerd: A PCB that thin would be so brittle it'd just snap when you look at it
09:19 AM dunz0r: Since it was "such a simple circuit, no one could mess this up"
09:19 AM Emil: LeoNerd: :D
09:19 AM Emil: True
09:19 AM rue_: were the 10 baords only about $50?
09:20 AM Emil: unless you want extra thicc paste
09:20 AM dunz0r: rue_: More like 10$
09:20 AM rue_: $10 for 10 baords?
09:20 AM dunz0r: Yep
09:20 AM rue_: with shipping?
09:21 AM dunz0r: Yep.
09:21 AM rue_: how big?
09:21 AM dunz0r: 50mm*50mm, two layers.
09:21 AM rue_: huh
09:22 AM Emil: dunz0r: whoch fab?
09:23 AM Emil: rue_: anycase pcbs cost nothibg
09:23 AM dunz0r: Emil: Seeedstudio at that time. I think dirtypcbs might be the better option nowadays, not sure
09:23 AM Emil: 10 100mmx100mm boards with free shipping is like 5-10e
09:23 AM rue_: yea, its a good reason for people to get boards made without checking the design and just throwing them out
09:23 AM Emil: jlcpcb has a special for first order
09:24 AM dunz0r: rue_: It's not like I didn't check the design multiple times... I'm just an idiot :)
09:24 AM Emil: 2 usd for first prser
09:24 AM Emil: order*
09:24 AM dunz0r: Seeed seems to have lowered their price even more.
09:24 AM dunz0r: 4.9$ for a 100mm*100mm board
09:25 AM rue_: will they ship to canada for that?
09:25 AM dunz0r: Yes. But shipping isn't free anymore, I think. Haven't used them since a few years ago
09:26 AM mohamed_: hello
09:28 AM dunz0r: But I suspect the shipping won't be very much anyway.
09:29 AM polprog: 5 bucks for a 100x100 pcb
09:29 AM mohamed_: Hello
09:29 AM rue_: if they ship from china
09:29 AM polprog: is that 2 sided with all the bells and whistles or just soldermask
09:29 AM rue_: then I'd be looking at 7 months shipping time
09:29 AM rue_: unless I pay $50 to have it couriered
09:29 AM mohamed_: I have posted a question
09:29 AM mohamed_: in the forum
09:30 AM rue_: what forum
09:30 AM mohamed_: just a second
09:30 AM dunz0r: polprog: Bells and whistles.
09:30 AM rue_: we dont have one
09:30 AM dunz0r: rue_: Nah, like 3-4 weeks or something
09:30 AM mohamed_: http://www.avrfreaks.net/forum/microsecond-delay-using-isr-timer0compvect
09:30 AM dunz0r: At least for me, and I'm in sweden.
09:30 AM mohamed_: ?
09:30 AM * Haohmaru shocks rue_
09:30 AM rue_: dunz0r, nope, canada post, 7 months
09:30 AM rue_: mohamed_, no, thats not us
09:30 AM mohamed_: LOL
09:30 AM Haohmaru: hahaha
09:31 AM Haohmaru: those are the evil avr folks?
09:31 AM mohamed_: yes
09:31 AM mohamed_: are you the good avr folks?
09:31 AM mohamed_: :)
09:31 AM Haohmaru: rue_ is the good stm32 guy
09:31 AM Haohmaru: ;P~
09:32 AM rue_: mohamed_, ANY variable thats modified in a isr, needs to be 'volatile'
09:32 AM mohamed_: OH NOOOOOOOOOO
09:32 AM mohamed_: Thanks so much
09:32 AM rue_: sound like you knew that
09:32 AM mohamed_: Yes
09:33 AM * rue_ snickers
09:33 AM Haohmaru: doesn't that apply only if you also deal with that variable from outside the interrupt?
09:33 AM rue_: good luck
09:33 AM mohamed_: I am new to embedded software
09:33 AM mohamed_: and new to programming as a whole
09:33 AM mohamed_: But I have noticed that solution before
09:33 AM mohamed_: will try it and tell you
09:34 AM dunz0r: Make sure you understand WHY they need to be volatile as well.
09:35 AM rue_: there is a problem there anyhow
09:35 AM rue_: its always founding
09:35 AM rue_: its always counting
09:36 AM mohamed_: ?
09:36 AM mohamed_: I have set the timer to CTC
09:36 AM mohamed_: Clear Timer
09:37 AM rue_: you either need to reset the time_var to zero or call it with the time_var+timeCpy
09:38 AM rue_: there are about 3 things you might be trying to do, I have to go to work
09:38 AM mohamed_: OK
09:38 AM mohamed_: Thanks
09:42 AM rue_: I know how to fix it, describe to the channel how your code works
09:45 AM mohamed_: :)
09:45 AM mohamed_: Ok
09:45 AM mohamed_: I am using timer0
09:45 AM mohamed_: on CTC mode
09:46 AM mohamed_: My understanding that whenever the timer ticks one tick it will compare the value
09:47 AM mohamed_: in TCNT0 to CMP0
09:47 AM mohamed_: if a match hapen it will fire the interrupt
09:48 AM mohamed_: so I have created a function that takes the number of microseconds as a parameter
09:48 AM mohamed_: and assigns that value to the global variable desiredTime
09:48 AM mohamed_: when the interrupt happens
09:48 AM mohamed_: and the ISR is executed
09:50 AM mohamed_: with each tick the time_var is incremented and compared with the value of desiredTime
09:50 AM mohamed_: if they are the same that means that the timer has counted the desiredTime
09:50 AM mohamed_: the endFlag is set to one
09:51 AM mohamed_: and when that happens the function Timer_vidDelayMicroSec will finish
09:52 AM mohamed_: What am I missing?
09:58 AM mohamed_: >>
11:41 AM polprog: YESS
11:41 AM polprog: SDCC 7.3.0 fixed all the issues!
11:41 AM polprog: how cool is that!
11:42 AM polprog: it now properly optimizes constant arithmetics and x |= (1<<y);
11:45 AM polprog: finally
11:45 AM polprog: !
11:47 AM Emil: polprog:
11:47 AM Emil: but
11:47 AM Emil: why
11:47 AM Emil: why not gcc
11:48 AM polprog: because gcc doesnt support stm8 im writing code for
11:48 AM polprog: do you think i wouldnt use gcc if it was available?
11:50 AM polprog: its good to know what tool you can try to use for writing C for weird CPUs
11:51 AM polprog: im using the best compiler thats available here
11:51 AM polprog: ofc I was and will be using gcc for AVR/stm32
12:18 PM splud: nuxil - thanks for uCurrent link yesterday. I'm aware of that device (and an uprated version, at least was on kickstarter). I may just have to implement something with the amps and roll my own for logging.
12:21 PM Emil: polprog: https://i.imgflip.com/24ykhl.jpg
12:21 PM polprog: if only i could
12:22 PM polprog: however stm8 looks kinda like 6502
12:22 PM polprog: i havent compared the instruction set yet
12:23 PM Emil: I mean support shouldnt be too hard to add right?
12:25 PM polprog: i know about compiler development even less than you
12:29 PM antto: stick Emil on a PCB, feed him c/cpp files in plain text, tie his legs onto signals - you're good to go now
12:29 PM Emil: :D
12:30 PM antto: if you slap him hard he will even accept minor syntactic errors ;P~
12:31 PM antto: IMO that's better than GCC
12:33 PM polprog: fck me sideways
12:33 PM polprog: okau
12:33 PM polprog: i fixed the retarded delay function
12:33 PM polprog: whoever wrote that file i was using for delay has no idea about C
12:34 PM polprog: so theres a macro T_COUNT(x) that returns ticks for given numer of microsecs
12:35 PM McDonaldsWiFi: polprog: which gcc toolchain do you use for stm32?
12:35 PM polprog: and there is _delay_ms which calls _delay_us(uint16_t __us);
12:35 PM McDonaldsWiFi: polprog: i tried to mess with it a while back and havetrouble
12:35 PM polprog: McDonaldsWiFi: just a sec
12:35 PM polprog: so guess why the preprocessor did not optimize it
12:35 PM polprog: because it was a function
12:36 PM McDonaldsWiFi: "function"?
12:36 PM McDonaldsWiFi: lol
12:36 PM polprog: so _delay_cycl( (uint16_t) ( (((( 16000L * __us) / 1000)-5)/3) ) ); this is when _delay_us is a static inline void
12:37 PM polprog: _delay_cycl( (uint16_t) ( (((( 16000L * 1000) / 1000)-5)/3) ) ); this is when i defined it a bloody macro
12:37 PM polprog: NO MORE STUPID RUNTIME EVALUATION GARBAGE
12:37 PM polprog: jesus im so mad
12:37 PM polprog: and yet so happy its fixes
12:38 PM polprog: i think will push that to github or write a post
12:38 PM antto: i normally use "const" whenever possible
12:38 PM antto: (const uint16_t __us)
12:39 PM antto: afaik that *should* help the compiler ;P~
12:39 PM polprog: theoretically
12:40 PM polprog: McDonaldsWiFi: so to answer your question, libopencm3 + arm-none-eabi-gcc
12:40 PM polprog: McDonaldsWiFi: see makefile http://polprog.net/papiery/stm32/
12:52 PM day__ is now known as day
12:55 PM polprog: odd. making _delay_cycl not static makes the delay exactly 2x longer
12:56 PM McDonaldsWiFi: polprog: thank you!
01:00 PM polprog: np!
01:03 PM polprog: finally delay is working as intended
03:21 PM polprog: https://i.redd.it/zjo53tgs8eh01.jpg
03:21 PM day__ is now known as day
03:22 PM Emil: Hmm
03:22 PM Emil: I wonder if one could just
03:23 PM Emil: like
03:23 PM Emil: just switch the op codes on avr vs stm8 :D
03:23 PM Emil: Compile to avr -> replace avr op codes with stm8 opcodes
03:24 PM polprog: not really avr-stm8
03:24 PM polprog: i feel like 6502-stm8 would work better
03:24 PM polprog: avr and stm8 are very different kinds of a beast
03:26 PM polprog: i feel the difference is the biggest in adressing modes
03:28 PM nuxil: that pic made my day :D
03:28 PM polprog: :)
03:29 PM Emil: That pic is some quality EE humour :D
03:31 PM polprog: hmm stm8 can execute from ram
03:31 PM Emil: uuu
03:31 PM Emil: nice
03:31 PM polprog: thats something new to me
03:32 PM polprog: still the fetching/execution times are horrible
03:44 PM Emil: ah you mean
03:44 PM Emil: that kind of ram
03:45 PM polprog: im trying to understand the concept of fecthing, stalling etc
03:45 PM polprog: but im too tires
03:45 PM polprog: tired*
03:45 PM polprog: i think ill go to sleeep now
03:45 PM nuxil: meh
03:46 PM nuxil: sleep is for the week :p
03:46 PM nuxil: get a cup of coffee :)
03:46 PM polprog: had one some time ago
03:46 PM polprog: ill just lie down...
03:47 PM polprog: i did a really big thing, getting that delay to work
03:47 PM polprog: heh
03:48 PM polprog: tomorrow i will have to talk my way out to borrow a scope for the "science day"
03:48 PM nuxil: what are you gonna do?
03:48 PM polprog: show that a cap only conducts AC
03:48 PM nuxil: what project
03:49 PM nuxil: well. thats only 1/2 true.
03:49 PM polprog: sec
03:51 PM nuxil: xc "Capacitive Reactance" changes with frequency. so depending on the values. xc may be so big that it almost blocks the freqency entierly. so it basically blocks the ac.
03:51 PM polprog: yeah, but in general, the resistance is infinite at f=0
03:52 PM nuxil: but in general. it passes ac and blocks dc.
03:52 PM Emil: polprog: what is DC but low frequency AC ;)
03:52 PM polprog: yeah, and if the frequency is high enough, then the parasitic inductance kicks in and impedance rises
03:53 PM polprog: https://puu.sh/zs7ej/f2e6f776f3.jpg the circuits are labeled 1) 2) and 3) (ill show them in that order)
03:53 PM nuxil: in the old days they just used caps in stuff as a reasisor from the mains.
03:53 PM nuxil: knowing the F. 50hz it was just a matter of calulating the value of the cap
03:54 PM polprog: mm
03:54 PM polprog: apart from those ill take a meter and measure the cap resistance as well at the beginning
03:55 PM polprog: every piece of technology that is sufficiently advanced is indistinguishable from magic ;)
03:58 PM nuxil: there is no such thing as magic :p.
03:59 PM polprog: of course there is ;)
03:59 PM polprog: http://catb.org/jargon/html/magic-story.html
04:00 PM Emil: nuxil: that's called capacitive power supply
04:00 PM Emil: and it's common
04:00 PM polprog: and the idiot who removed that switch is a troglodyte
04:00 PM nuxil: Emil, not so common as it used to be. to caps failure rate is rater high on thouse.
04:07 PM nuxil: polprog, i belive i read that story before some time ago.
04:07 PM polprog: everyone dod
04:07 PM polprog: did*
04:07 PM polprog: :P
04:14 PM polprog: so, pretty simple stuff and not much gear to take
04:15 PM polprog: i have this smal +5, +-15V psu, ill take a meter, my old unitra scope probe (just in case) and a bag of parts needed
04:16 PM nuxil: make a rc. and show the time constant on the scope
04:16 PM polprog: maybe
04:16 PM nuxil: just as a bonus
04:16 PM polprog: ill take the cap box and the resistor box and improvise
04:17 PM polprog: just like i improvised last year, playing scope demos from phone (connected to scope) as a bonus :P
04:19 PM polprog: night
04:20 PM nuxil: gn
06:08 PM unregisteredandf: HELLO
06:16 PM nuxil: hi
06:18 PM unregisteredandf: what is up?
06:19 PM unregisteredandf: i am trying to find a perfect and most effective arrangement of the segments and shift register bits but different types have different pinouts ;/ and i don't want to make a bard for every type
06:19 PM nuxil: not much. looking at page 432 and trying to deside which register to use for holding a bit.
06:19 PM unregisteredandf: :)
06:22 PM nuxil: 7 seg displays ?
06:23 PM nuxil: yea not only may they pinnout vary. if they dont follow standards. you also have common anode and common cathod types.
06:24 PM cehteh: you define the 'font' right? that is mapping from glyps to bits/segments lit?
06:24 PM unregisteredandf: nuxil: ya, 595 chain extended http://www.kingbrightusa.com/images/catalog/SPEC/ca56-11ewa.pdf
06:27 PM nuxil: unregisteredandf, youre mixing different types of 7seg disps ?
06:28 PM unregisteredandf: nuxil: i don't want to but there is no guarantee that i will always be able to get the same type ;/
06:28 PM unregisteredandf: lel i have pulse tig welded together 2 stainless steel needles and put put them in a ceramic halogen socket, then plugged in a 400W psu's 3v3, it glows nce red hot
06:29 PM nuxil: someday. you gonna burn down your house :p
06:31 PM unregisteredandf: nuxil: there is a solution to that too, preventing only requires not having one
06:42 PM nuxil: so i think im done with this "chip 2 chip 2 chip" protocole. sees to work as i want it now.
06:44 PM nuxil: master chip sends data on i2c bus having spi data encoded in it. gets to a I/O expander board and sends the spi data to the misc chips. then waits for and ack signal back. :p
06:44 PM nuxil: been a mess to get working :p
06:45 PM Tom_L: sounds like self enflicted pain
06:45 PM nuxil: it has been indeed :D
06:45 PM LeoNerd: Umm... SPI over I²C ? That soudns fun
06:46 PM Tom_L: makes me scratch my head and wonder wtf why
06:47 PM LeoNerd: I've sent SPI over SPI before, by using a 74'595,... then chained the process a bunch of times, just to demonstrate that it's possible. But that was for a silly demo
06:47 PM nuxil: becasue. i was out of pins. had two pins left, i2c was choice since i have display thats i2c and a i/o expander.. the other chips are spi so yea.. thats why.
06:48 PM nuxil: this mcp23008 i/o expander im using is kind of awesome chip tho. it got intrupts and all that shit :p i like it.
06:49 PM LeoNerd: Mm.. I've considered it before, but a tiny bit too expensive for things I had in mind :/
06:49 PM LeoNerd: The PCF8574 is *almost* as nice, and dirt-cheap
06:50 PM LeoNerd: It does have change interrupts, just not mask or direction register, so you get informed of every change of every pin, whether you wanted it or not
06:51 PM LeoNerd: Very handy for front panel LED/button offload though; I²C's relatively slow speed is fine for human-IO tasks
06:51 PM nuxil: yea
06:52 PM LeoNerd: Without masking or direction config, you end up getting 4 interrupts per click of a rotary encoder though, is the only downside I've found to this plan.
06:53 PM LeoNerd: If you move one of the rotary outputs directly to a pin on the MCU and just read that when the interrupt comes for the other one, you can halve that to 2
06:54 PM unregisteredandf: spi and dma would be the proper way to out on static display ;)
08:38 PM rue_: test
08:38 PM rue_: hmm
08:38 PM Thrashbarg: hmm?
08:38 PM nuxil: test ? no ping, no pong :p
08:40 PM APic: ;=P
08:40 PM rue_: trying to set a iptraf filter
08:40 PM rue_: not working
08:40 PM APic: Passed.
08:40 PM rue_: no, it didn't show the traffic to the irc server
08:40 PM rue_: my network has chatter
08:40 PM rue_: want to filter it out
08:45 PM unregisteredandf: would you use a cat5 cable strand or a 0.4mm enameled copper wire to connect/route stuff manually? the single strand enameled has better temperature stability, thinner, but more brittle, the plastic on the cat5 strand melts easily, but breaks harder
08:47 PM unregisteredandf: the enameled copper is basically a thick bond wire
08:49 PM rue_: tedx
08:49 PM rue_: now it works
09:25 PM Casper: unregisteredandf: the insulation on cat5 is more like wax, very low temperature and fragile
09:26 PM Casper: I'ld go with enamel<
09:26 PM unregisteredandf: Casper: but it has nice 7 stranded conductor :)
09:26 PM unregisteredandf: harder to break it
09:28 PM unregisteredandf: i also used single wires from it for hacking stuff
09:28 PM Casper: the insulation melt when you heat it up
09:28 PM unregisteredandf: ya i know ;/
09:28 PM unregisteredandf: it should be silicone
09:28 PM unregisteredandf: or enamel
09:31 PM Casper: oh 2 crashes today on that bridge!
09:32 PM Casper: https://www.youtube.com/watch?v=BK7roTklGyg https://www.youtube.com/watch?v=zvL4ONNnJ44
09:32 PM unregisteredandf: Casper: enamel wire is like insulated bond wire :)
09:32 PM Casper: I know what enamel is
09:32 PM Casper: I even have some rolls
09:32 PM unregisteredandf: unlimited number of isolated layers ^^
09:33 PM unregisteredandf: mee 2
09:33 PM unregisteredandf: i like the high temp 180°C stuff with double layer enamel
09:33 PM unregisteredandf: not easy to strip it
09:35 PM unregisteredandf: i will try pulse tig welding it now :>
09:41 PM unregisteredandf: Casper: i used cat5 cable now to wire a temp sensor ;/ i need to get some glass sleeve for the hot end
09:48 PM McDonaldsWiFi is now known as StudentLoans
09:48 PM StudentLoans is now known as McDonaldsWiFi
10:30 PM nuxil: Casper, haha that bridge. been so many trucks smashed into it. got to hold world record :p
10:31 PM Casper: yeah
10:31 PM Casper: I'm actually impressed by the last one
10:31 PM Casper: the mic part
10:32 PM nuxil: whats the average ? 1 per week ? im sure they keep stats on that bridge :p
10:33 PM nuxil: anywho.. what will this do?
10:33 PM nuxil: uint8_t Buffer[BUFFER_SIZE] __attribute__ ((aligned(BUFFER_SIZE))) __attribute__ ((section (".noinit")));
10:34 PM rue_: you would think they would put a dummy bar infront of it
10:36 PM Casper: Published on Apr 14, 2008 is the oldest video... 129 recorded...
10:36 PM Casper: so basically 13 per year?
10:36 PM Casper: that was on camera of course
10:36 PM Casper: so I'ld say it average 1 per 3 weeks?
10:36 PM rue_: hah allmost all penski tental trucks eh?
10:37 PM Casper: nope
10:37 PM rue_: almost all rental trucks
10:37 PM Casper: however I suspect penski make a fortune out of the repairs
10:38 PM Casper: they most likelly bill for the down time
10:40 PM rue_: they should put a repair place right on the corner
10:40 PM rue_: wtf, this guy goes back to turn into it
10:40 PM rue_: oh he's smart tho
10:41 PM Casper: there is some nice ones there
10:47 PM rue_: not the only one apparently, and lots more pensky trucks
10:49 PM rue_: ooohk, I have one hour to do SOMETHING on my 3d printer
10:49 PM rue_: wire a zero sensor or two?
10:49 PM nuxil: still waiting on mine
10:57 PM theBear: zero sensor or two eh ? is that what they talkin' bout when people say double or nothing ?
10:58 PM rue_: heh
10:58 PM rue_: "I'll take your nothing and double it!"
10:58 PM theBear: heh, it always sounded potentially positive before now, the double bit i mean...
11:03 PM rue_shop: I wonder if pensky has good deals on flatbed trucks
11:49 PM unregisteredandf: hi
11:50 PM unregisteredandf: dammit that enameled 400um bond wire is tough
11:50 PM unregisteredandf: can't simply pulse tig weld it
11:51 PM unregisteredandf: and the insulation easily takes 400V