#avr Logs

Feb 20 2017

#avr Calendar

12:24 AM daey_ is now known as daey
03:40 AM Emil: I never understood what was so special about the teensy bootloader
03:41 AM Emil: I mean, you can easily have the asm and since the bootloader has a max size it wouldnt be hard ro understand
03:43 AM Emil: LeoNerd: what serial chip is that?
03:43 AM Emil: Seems like ftdi
03:43 AM skz81: Morning folks
03:43 AM skz81: Lambda_Aurigae, thanks for pointing out tux graphics, it helped
03:44 AM Emil: And why a resonator
03:44 AM Emil: and not a crystal
03:45 AM Emil: Ooh, the ch comes in a format like that, also
03:45 AM Emil: I should source a few of them
03:49 AM Emil: LeoNerd: where do you buy those ch340s
03:50 AM skz81: played around a bit with the ENC28J60 and was able to send out UDP frames
04:35 AM skz81: http://skuizh.free.fr/AVR/oPS_20170219.jpg
04:35 AM skz81: http://skuizh.free.fr/AVR/oPS_20170219_3.jpg
04:39 AM Polprog: nie shop
04:39 AM Polprog: nice *
04:45 AM malinus: skz81: is that chip just the physical layer?
04:46 AM malinus: or does it include a bit more?
04:46 AM skz81: malinus, MAC+PHY + control (SPI registers)
04:47 AM skz81: Polprog, thanks ! But, you mean.... The mess in the background ?
04:48 AM malinus: I guess there are libraries for the rest
04:52 AM Lambda_Aurigae: tuxgraphics.com
04:52 AM Lambda_Aurigae: they have a nice AVR lib for the enc28j60
04:52 AM Lambda_Aurigae: and some demo apps as well.
04:53 AM Polprog: you should see my bench ;) is it difficult to control that ethernet chip?
04:53 AM Lambda_Aurigae: you just need to add magnetics and a crystal for the chip to work.
04:53 AM Lambda_Aurigae: difficult, yes....but if you use a premade library it gets simplified dramatically.
04:54 AM Lambda_Aurigae: for play-around purposes I recommend getting the chip on a module with all addon electronics.
04:54 AM Lambda_Aurigae: most come with a magjack that has the magnetics and LEDs in the jack.
04:54 AM LeoNerd: Emil: CH340G. From eBay. Resonator because it's cheaper than xtal; less accurate but that's fine for USB
05:07 AM skz81: Lambda_Aurigae, I like the driver part of the tuxgraphics lib, but the API part is messy IMHO... Not a real problem though, I'll code my own
05:08 AM skz81: Not enough room (mainly RAM actually) to embed uIP
05:08 AM skz81: but it compiles on top of the tuxgraphics driver
05:08 AM Lambda_Aurigae: I run it on an atmega1284p...lots of room..hehe
05:08 AM Lambda_Aurigae: anyhoo,,off to the pool.
05:09 AM skz81: For now I was prototyping using Arduino Uno R3 board, so stuck with m328p :p
05:10 AM skz81: <Lambda_Aurigae> difficult, yes.... >> It is not "easy", sure, but not so hard... The DS is pretty clear also.
05:46 AM malinus: Lambda_Aurigae: I'm trying to find one for my stm32 :3
05:47 AM malinus: Finding libraries for avr8 has never been a problem
05:52 AM skz81: What prevent you to reuse/port them to stm32 ? I guess after adaptation of SPI reads/write, the rest should compile and run seamlessly
05:52 AM skz81: the enc28J60 driver code is not huge...
05:53 AM skz81: https://github.com/patrick--/AVR-ENC28J60-Examples/blob/master/tuxlib/enc28j60.c
05:54 AM skz81: (I used this repo AS IS to send raw UDP packet yesterday, the enc28j60.c file directly out from tuxgraphics... The whole 'tuxlib/' directory, even ;°)
05:55 AM skz81: malinus, ^
05:55 AM malinus: oh nice, thanks
05:55 AM skz81: hum not exactly AS IS, I tweaked the makefile :p
05:58 AM skz81: malinus, no prob, i'm glad I could help ; thanks to Lambda_Aurigae by transitivity
05:59 AM skz81: NOTE, as said formerly : I LIKE the enc28j60.* but not really the upper layer (ip_arp_udp_tcp.*) to build up my mni web-server.
06:00 AM skz81: didn't look at websrv_help_functions.* but at a first glance it looks helpful, will prolly keep this one
06:00 AM skz81: there are many other 'forks' around github, just dig in :p
06:00 AM skz81: search "avr enc28j60" or so.
06:01 AM skz81: (with different upper layers I mean)
06:06 AM Emil: LeoNerd: hmm
06:07 AM Emil: I wonder where I could even source ch340 reliably
06:07 AM Emil: digikey nor mouser carry it
06:07 AM Emil: skz81: nice!
06:07 AM Emil: Do you need to form the raw ethernet packet?
06:07 AM Emil: Or the Ip packet?
06:07 AM Emil: or is ip provided
06:23 AM twnqx: Emil: depends how good your chinese is :P
06:25 AM twnqx: but most likely alibaba.
06:25 AM twnqx: especially for less than a reel
06:26 AM malinus: skz81: I just need to send a udp packet once in a while.
06:32 AM Emil: twnqx: that's quite unfortunate :D
06:35 AM ravon: Where does one go to report bugs in ASF nowadays?
06:35 AM Emil: ASF?
06:36 AM ravon: Atmel's abstraction framework.
06:36 AM Emil: The heck is that?
06:39 AM ravon: http://asf.atmel.com/docs/latest/
06:40 AM ravon: They used to have a bug tracker for it but it seems closed down, and the technical support on atmel.com is in "maintenance mode" (IIRC it was last week as well)
06:41 AM LeoNerd: Emil: eBay or Aliex seem to be the only real sources of them. :/
06:50 AM malinus: sounds like some high-level API
06:51 AM skz81: <Emil> Do you need to form the raw ethernet packet? >> Nope, AVR (or anything else) generates L3 packets, ENC28J60 manages MAC+PHY (L2+L1)
06:51 AM skz81: Emil, and if you have room to embeded uIP you have a (nearly) IP full-stack API
06:52 AM skz81: TCP even
06:55 AM Lambda_Aurigae: that tuxgraphics lib also does udp...good for feeding data out of the chip quickly.
06:56 AM * Lambda_Aurigae am all chlorinated now
07:02 AM Lambda_Aurigae: spent an hour in the pool this morning.
07:02 AM Lambda_Aurigae: chlorinated and worn out.
07:18 AM Emil: skz81: so I can directly shout udp but to do tcp I need to implememt it myself
07:19 AM Emil: ?
07:20 AM skz81: for UDP there is still a (simple and little) header to generate also
07:20 AM skz81: but yes the idea is here
07:20 AM Emil: skz81: so ip packets
07:20 AM Emil: need to generate ip packets
07:21 AM skz81: yup you're right IP is NOT* managed by the chip, neither
07:21 AM Emil: skz81: if you look up I asked about that also ;)
07:21 AM skz81: Emil, if you lookup I answered :)
07:22 AM skz81: "AVR (or anything else) generates L3 packets, ENC28J60 manages MAC+PHY (L2+L1)"
07:22 AM skz81: L3 is IP here ;°)
07:22 AM Emil: That doesnt tell me anythg :D
07:22 AM skz81: L4 is UDP or TCP
07:22 AM skz81: https://en.wikipedia.org/wiki/OSI_model
07:23 AM Emil: Ah you are talkig about those layers
07:23 AM skz81: yup
07:23 AM skz81: What else ? (c) coffe cup actor
07:27 AM Emil: skz81: what's the load to handle ip/udp?
07:27 AM Lambda_Aurigae: ye olde pyramid!
07:27 AM Emil: If I want to actively stream data
07:27 AM Jartza: hallo
07:27 AM Emil: Hola
07:27 AM Polprog: hello
07:28 AM Emil: skz81: like lets say at 1Mbaud
07:28 AM enhering is now known as ENHering
07:28 AM Emil: hmm, oh dear
07:29 AM Lambda_Aurigae: Emil, that's gonna be hard on the enc28j60...it is spi interfaced...you would be pushing the limit of the chip and then some I think.
07:29 AM skz81: Emil, I guess... That... Depends ? I don't know, not an expert yet :p
07:29 AM skz81: <Lambda_Aurigae> Emil, that's gonna be hard on the enc28j60...it is spi interfaced...you would be pushing the limit of the chip and then some I think. >> Maybe only updating some bytes in the frame and re-send, it could be possible ?
07:29 AM Emil: Lambda_Aurigae: hmm, spi at 4MHz, Inwould pretry much need to constantly assemble packets
07:30 AM Emil: At 4MHZ I would have some 40 cycles between spi writes
07:30 AM Emil: Probably better at that point to go for 8MHz
07:32 AM Lambda_Aurigae: hmmm.
07:32 AM Lambda_Aurigae: the datasheet says 20MHz clock on the spi. I didn't realize it was that fast.
07:33 AM Lambda_Aurigae: getting an AVR to push SPI that fast ain't gonna happen though.
07:33 AM Emil: Lambda_Aurigae: f_cpu/2 maximum
07:34 AM Lambda_Aurigae: yup
07:34 AM Emil: I dont know if receiving works at that speed, thiugh
07:34 AM Emil: I think to have bidirectional it needs to be f_cpu/4
07:34 AM * skz81 whistles
07:34 AM Lambda_Aurigae: so maybe up to 5MHz.
07:35 AM skz81: you DONT have to retransmit ENTIRE frame every time
07:35 AM Lambda_Aurigae: on an AVR...non-xmega
07:35 AM Emil: skz81: hmm, that's interesting
07:35 AM skz81: can update a part I'm pretty sure
07:35 AM skz81: I bet a ball on it
07:35 AM Lambda_Aurigae: yeah..it does have a buffer.
07:35 AM Emil: That would be reslly damn nice
07:35 AM Emil: Broadcast udp, router would handle distribution
07:36 AM Emil: I think it would work
07:36 AM Emil: of course on lan
07:38 AM Emil: skz81: what's the packet size
07:39 AM skz81: ethernet standards, don't have them handy
07:39 AM skz81: 4K buffer iirc
07:39 AM skz81: 8k rather
07:39 AM Emil: Could probably just slap a counter + length on it and then just stream 1k messages
07:40 AM Emil: Or larger
07:40 AM Emil: unlikely that thwy would be lost on lan
07:40 AM skz81: IIRC the payload of an eth frame is about 1600bytes or so
07:40 AM Emil: 1550 ii4c
07:41 AM Emil: Hmm, I should buy a few of these
07:47 AM Emil: Could you try streaming to multiple?
07:48 AM Emil: Or does it always require to stream to multiple yourself?
07:48 AM Emil: In theoy it is changing a single byte and then sending again if in same subnet
07:48 AM Emil: but still
07:52 AM skz81: Emil, what are you asking to me exactly ?
08:04 AM Lambda_Aurigae: there is always broadcast streaming on local subnet.
08:20 AM skz81: haaaa ! "streaming to multiple" !! ok :)
08:49 AM Emil: skz81: streaming from a si gle avr to multiple receivers the same data
08:51 AM Emil: And a receiver can and probably will be a regular linux
08:52 AM skz81: Emil, ok, just as Lambda_Aurigae it is always possible on a LAN
08:52 AM skz81: even with this chip
08:54 AM skz81: a bit of chip config and some other bit of packet forging and you go
08:54 AM skz81: unsure what % of config vs. forging
09:02 AM maciejjo_ is now known as maciejjo
09:05 AM Lambda_Aurigae: never tried local broadcast with one...I should.
09:05 AM Lambda_Aurigae: need to configure one to stream something...maybe hook up a mic to the ADC or something.
09:06 AM Emil: Lambda_Aurigae: yeah, mic streaming is entirely possible
09:06 AM Lambda_Aurigae: or even radio feed into it...and stream to multiple computers.
09:06 AM Emil: at 48000 and 8 bit depth it is only 0.384Mbps
09:07 AM Polprog: why bother with adc
09:07 AM Lambda_Aurigae: that's AM radio quality!
09:07 AM Polprog: generate number sequences
09:07 AM Lambda_Aurigae: Polprog, well, to get analog mic to digital numbers.
09:07 AM Lambda_Aurigae: what's the fun in that?
09:07 AM Emil: And that is raw bitstream
09:07 AM Polprog: oh i thought the aim was to stream anything
09:07 AM Lambda_Aurigae: yeah.
09:07 AM Polprog: nvm
09:08 AM Lambda_Aurigae: what's non volatile memory to do with it?
09:08 AM Emil: ;)
09:31 AM NonaSuomy is now known as NoSu02
09:35 AM Jartza: ha
09:35 AM Jartza: got very rudimentary basic running already on attiny
09:37 AM malinus: Jartza: hook a display to it :)
09:37 AM malinus: and a keyboard
09:37 AM cehteh: and internet
09:38 AM malinus: exactly, it's a attiny ;)
09:38 AM Ad0: what's the smallest AVR with proper UART and 3+ ADC?
09:39 AM LeoNerd: ATtiny841 maybe?
09:39 AM Ad0: kk
09:39 AM Jartza: probably
09:39 AM cehteh: tiny84? .. has uart i think
09:39 AM Jartza: malinus: I have display, I use octapentaveega
09:39 AM LeoNerd: tiny84 lacks a UART, has only the USI
09:39 AM cehteh: ah k
09:40 AM Jartza: yea, 841 is 84 replacement
09:40 AM malinus: no spi?
09:40 AM cehteh: Ad0: did you gave up with softuart?
09:40 AM malinus: Jartza: oh I've seen this project before. nice. What are you making now?
09:40 AM Polprog: that USI interface can work in 2 wire and 3 wire mode emulation i2c and spi
09:41 AM cehteh: oh 841 has 2 usarts ... interesting
09:41 AM LeoNerd: Yeah.. it's odd. I don't know any ATtiny with one UART
09:42 AM Polprog: yeah, i found the datasheet yesterday
09:42 AM LeoNerd: Most have neither; the tiny841 has 2
09:42 AM Polprog: its also slightly cheaper than 84
09:42 AM LeoNerd: Yes, possibly because of volume. The 841 is basically an upgrade/replacement of the 84
09:42 AM Ad0: cehteh: I found out that I need to tune the osc according to it's supply voltage
09:42 AM Ad0: the PI had 3.3, I had 5.1
09:42 AM Ad0: thus it didn't work well on the PI
09:43 AM Ad0: I need something that delivers an avg of 1024 samples on 3 ADCs in under 0.5 secs
09:44 AM cehteh: sounds simple
09:44 AM LeoNerd: USI can do I²C *or* SPI, but if you need to talk both it takes a little bit of work
09:44 AM Emil: Ad0: extrenely
09:44 AM LeoNerd: I found a really cute way to do it though :)
09:44 AM LeoNerd: The trick is to use a 1-gate analog switch chip (e.g. one of the 1G66 chips) to connect the SDA line, and control that from the SPI SS pin
09:45 AM LeoNerd: SS low => SPI chip is activated, analog switch is open. So SPI slave talks and I²C line is idle
09:45 AM LeoNerd: SS high => SPI chip is deactivated, analog switch is closed, so you can talk I²C
09:45 AM cehteh: well i never tried to fast mux adc inputs, whats the latency on the muxer, i bet stray capacitances will make a mess when you mux really fast
09:45 AM Ad0: hehe cool
09:46 AM Ad0: I might just get an ADC SPI shield for the PI
09:46 AM LeoNerd: I've never had much luck fast switching the ADC MUX
09:46 AM RikusWork: LeoNerd: ATtiny2313 got one UART
09:46 AM cehteh: but 1024*3 samples in 0.5 sec isnt really fast
09:46 AM LeoNerd: RikusWork: ohyes, true. But no ADC
09:48 AM RikusWork: I wrote some MDIO bitbanging code the other day at work, it uses the Linux kernel gpio interface, so rather slow.... 300us per clock, now 140us
09:48 AM RikusWork: It is to access some 100base-T1 phy's
09:48 AM RikusWork: aka BroadR-Reach
09:49 AM Ad0: http://docs-europe.electrocomponents.com/webdocs/1380/0900766b81380acd.pdf
10:01 AM Jartza: malinus: octapentaveega is "one piece of a puzzle" :)
10:01 AM Jartza: malinus: the full goal is to build "retro style computer" using attiny85 chips
10:02 AM Jartza: like stand-alone computer that can be programmed using basic and has display and audio and keyboard connectivity :)
10:05 AM malinus: Jartza: how many attiny85 would you need for that, do you think :)?
10:05 AM malinus: Jartza: is there any reason to do it all with attiny85? Other than it's pretty cool :)
10:07 AM Jartza: no specific reason :)
10:07 AM Jartza: depending if BW VGA output is enough, maybe even 3 attinies are enough
10:07 AM Jartza: for 8 color VGA, 5
10:08 AM Jartza: it's like main cpu + co-processors, except co-processors are attinies too :)
10:09 AM specing: just take a single cortex-m
10:11 AM skz81: specing, you fun killer !
10:11 AM Jartza: boring
10:12 AM specing: its not boring when you spend a week figuring out which clocks to enable
10:12 AM specing: and then another week to trace that thing causing the hard fault handler to fire
10:12 AM Jartza: naah
10:12 AM malinus: specing: haha that does indeed sounds like cotrex-m development ))
10:13 AM Jartza: I develop to cortex m at work
10:13 AM specing: malinus: tell me about it.....
10:13 AM Jartza: for hobby stuff, avr is nice
10:13 AM malinus: "you forgot one of those 50 32-bit registers that needs to be set in a specific sequence to enable this GPIO"
10:13 AM malinus: Coming from 8-bit AVR it really is a handfull
10:14 AM specing: someone should make a cortex-m for dummies
10:14 AM specing: I'd buy it
10:16 AM malinus: specing: well I'm pretty sure there is an arduino implementation for some cortex-m?
10:16 AM malinus: some/one
10:16 AM skz81: arduino core for cortex-m ? ooooops :p
10:16 AM Jartza: arduino for cortex m = mbed.org
10:16 AM skz81: malinus, synchronous ! :p
10:17 AM malinus: nah I was way ahead ;)
10:17 AM Jartza: also, mbed.org IS cortex m for dummies :)
10:17 AM specing: I think my problem is that I want to get as low level as possible and proceed to get lost in the details
10:17 AM skz81: malinus, sure. Hundered of thousands of nanoseconds
10:17 AM malinus: :)
10:18 AM malinus: specing: I could recommend the libopencm3 library and some stm32fX, but I can't do that in here. Helps you get started
10:18 AM malinus: and then you can still dive in all the details
10:18 AM specing: malinus: also I'd like to do Ada
10:19 AM bss36504: I've recently been trying to get more into cortex M. What a cluster
10:19 AM bss36504: I'm using a Freescale Kinetis processor...do most vendors separate their GPIO registers into "GPIO" and "PORT" registers?
10:19 AM bss36504: It's infuriating.
10:20 AM Jartza: the most fun is when you learn to use one of them, and switch manufacturer.... you need to learn it All Over Again :D
10:20 AM malinus: bss36504: well even avr8 does that?
10:20 AM bss36504: No
10:20 AM bss36504: this is literally a naming convention thing
10:20 AM bss36504: I hate it
10:20 AM Jartza: bss36504: lol, kinetis. have fun.
10:20 AM malinus: I'm not sure what you mean by the seperation then
10:21 AM bss36504: Jartza: Yeah I don't like it. Not really my choice though
10:21 AM Jartza: cortex m core, then someone did let the old motorola dinosaurs our from the closet and they added powerpc peripherals to the chip :p
10:21 AM Jartza: endianness and all
10:22 AM Jartza: "what do you mean data to be written to flash needs to be big endian?"
10:24 AM bss36504: malinus: In order to set up a pin to act as a GPIO, you need to read two different chapters in the datasheet that evidently cover different peripherals; The "Port Control and Interrupts (PORT)" chapter, and the GPIO chapter.
10:24 AM bss36504: And then, that just makes it more annoying to write convenient and flexible functions to configure any pin on any port
10:24 AM bss36504: I got around it, but it just irks me.
10:26 AM bss36504: Then I tried setting up the I2C peripheral. 1st problem is I'm pretty unfamiliar with I2C, 2nd problem is that module seems very complicated. And the datasheet kind of sucks. And Freescale/NXP/Whatever they are doesn't really do much for app notes.
10:34 AM malinus: bss36504: yeah that's why I prefer some higher-level api. Just to get your started. You gonna end up flipping the register no matter what.
10:34 AM malinus: But with those 32-bit things you sometimes want things to start working first
10:37 AM bss36504: From what I read it seems that the kinetis API isn't finished yet
10:37 AM bss36504: Granted I don't fully understand the "ARM Ecosystem" and what is to be expected or not, but I'm pretty sure I read that somewhere
10:38 AM bss36504: I did locate a bunch of baremetal code from NXP, however it's been a real bitch to get it to build. Trying to work out the dependancies is a pain in my ass. And it turns out their I2C driver was a piece of shit anyway
10:40 AM bss36504: So likely I'll just learn to roll my own I2C lib for what I need. Freescale/NXP really pushes their Processor Expert stuff, but in this case I don't want to use it, I want bare metal libraries.
10:44 AM malinus: yeah libopencm3 is just that. But I think they mostly support stm32
10:47 AM bss36504: Yeah overall I'm just not impressed with Freescale for their documentation and code support. They seem to have put all their eggs in the Processor Expert basket
10:47 AM bss36504: The chip I'm using is CM0+
11:11 AM _ami_: https://silica.io/static/downloads/kicad-cheatsheet.pdf
11:17 AM _ami_: skz81: Hi
11:18 AM _ami_: one question regarding pwm kernel driver (https://www.kernel.org/doc/Documentation/pwm.txt).
11:18 AM _ami_: my board has 3 timers and each timer has 2 pwm outputs so this make total no. of pwm count to 6.
11:18 AM _ami_: in this case, should i create a gpiochip and include all 6 PWMs or create 3 pwmchips and each contains 2 pwms?
11:39 AM _nexxus__ is now known as _nexxus_
11:42 AM JanC is now known as Guest41946
11:42 AM JanC_ is now known as JanC
01:24 PM LoRez_ is now known as LoRez
04:31 PM arij is now known as arij_work
08:27 PM arij_work is now known as arij
11:50 PM rue_shop3: ugh
11:50 PM rue_shop3: is it pwm for hobby servos?
11:57 PM _ami_: that ##stm32 is fucking troll group
11:57 PM _ami_: fucking hate them.