#avr Logs

Aug 22 2020

#avr Calendar

01:09 AM rue_shop1: http://www.engbedded.com/fusecalc/
02:36 AM rue_shop1: ok, I'm having a WTF
02:37 AM rue_shop1: I cannot get a timer to change its interval
02:37 AM rue_shop1: I'v tried CTC, and fast pwm modes
02:37 AM rue_shop1: where top is defined by OCR1A
03:00 AM rue_shop1: well, the old horid way works
03:00 AM rue_shop1: when you get the interrupt, reset the counter
03:01 AM rue_shop1: yuck
05:21 AM cehteh_: rue_bed2: wrong configured timer :)
05:21 AM cehteh_: we had that a week ago
09:43 AM JanC is now known as Guest31265
09:43 AM JanC_ is now known as JanC
09:58 AM TechChristoph: mhm
11:52 AM Miyu is now known as hackkitten
01:32 PM TechChristoph: mhm
01:32 PM TechChristoph: now it works
03:09 PM rue_shop1: cehteh_, it should be easy to get a timer in ctc mode to TOP at somewhere arbitrary tho, like 236
03:09 PM rue_shop1: how about I throw ya a template, see if you can do it
03:10 PM rue_shop1: cause everything I was, couldn't get it to happen last night
03:10 PM rue_shop1: https://paste.debian.net/1160877/
03:14 PM cehteh_: some days ago i spotted a buf in someone elses code who tried to configure ctc mode
03:15 PM cehteh_: the problem is that the wgm bits are spread over TCCR1A and TCCR1B
03:15 PM cehteh_: i have to look at the datasheet as well , not now
03:53 PM dgriffi: what is the correct way to print blocks of text through an rs232 connection without running out of RAM?
03:54 PM dgriffi: I've tried doing stuff like "const char foobar[] PROGMEM = "lorum ipsum...\n";
03:55 PM dgriffi: and then "printf_P("%s", foobar);" but this still results in garbled output when too many printf_P() calls are in one function.
03:55 PM dgriffi: or too printf_P()s are present anywhere.
03:56 PM nohit: have you read this https://www.nongnu.org/avr-libc/user-manual/pgmspace.html
03:57 PM dgriffi: nohit: yes. I don't get how to convert that into terms of printf
03:58 PM LeoNerd: printf_P() if your format string comes from program memory, %S if your argument does
03:58 PM LeoNerd: Or use one of the newer 0- or 1-series UPDI-based chips with unified memory model and then you don't need to care ;)
03:59 PM LeoNerd: Flash is visible from the data space there
03:59 PM dgriffi: I'm using atmega164p and atmega324p...
04:04 PM dgriffi: using %S didn't help
04:06 PM Emil: dgriffi: consider joining #avrs
04:06 PM cehteh_: spam :D
04:06 PM dgriffi: hm?
04:07 PM cehteh_: dgriffi: whats he actual problem, garbled/incrorrect output because of address space / progmem problems
04:07 PM cehteh_: or running out of ram
04:08 PM cehteh_: i dont know how the avr-libc implemented that but i have my own routines/serial code which can print from progmem, even partial strings
04:11 PM cehteh_: iirc the avr-libc functions are quite rudimentary
04:24 PM dgriffi: cehteh_: My best guess was that I filled up ram and scribbled over important stuff.
04:25 PM dgriffi: cehteh_: I have around 30 lines of help info. So to get a feel of things, I had the help command print all the help info in one go instead of giving it topic by topic
04:25 PM dgriffi: cehteh_: what happened was the last five lines of the last block was printed repeatedly
04:26 PM dgriffi: When I put the text into #defines, the AVR was just stone dead.
04:27 PM dgriffi: just now I tried printf_P(help_foobar); where help_foobar is defined like this:
04:27 PM dgriffi: const char help_foobar[] PROGMEM = "lorem ipsum....\n";
04:27 PM dgriffi: that worked
04:37 PM cehteh_: yes thats correct
04:37 PM cehteh_: note there is a catch between storing a pointer in progmem and the actual data :) ... need some tricks to work around that with array
04:39 PM cehteh_: its not so trivial tp print a lot of data from AVR'S esp when you dont want to block your program
04:40 PM cehteh_: i made a tagged/compressed queue for that, slightly complex, but helps a lot when you want to conserve ram and have bursts printing a lot
04:55 PM dgriffi: another problem... structs don't seem to want to work as they do on a regular computer: See https://pastebin.com/RdB1LDh6
04:58 PM twnqx: that's not correct C
04:58 PM twnqx: you typedefed the struct, not declared a variable with this type
05:03 PM dgriffi: brainfart
05:03 PM twnqx: happens.
05:05 PM twnqx: like i have a piece of code that i absolutely fail to figure out how it runs roughly 8.5 times faster on a 500mhz arm compared with a 3.6GHz Threadripper.
05:05 PM dgriffi: twnqx: that's got to be maddening
05:06 PM twnqx: not really, given i only care about the performance on the ARM :P
05:06 PM * dgriffi reaches for caffinated fluids
05:08 PM dgriffi: I wonder if this separated memory/code will make it impossible to write a Z-machine for an 8-bit AVR
05:09 PM dgriffi: I'm working on a modem sort of device, but as I beat on the code, I'm thinking how fun it would be to make a USB device that you plug in and connect to with a terminal program to play a game.
05:11 PM cehteh_: Z-machine?
05:12 PM cehteh_: ah
05:12 PM dgriffi: cehteh_: Infocom... Zork... Planetfall...
05:12 PM cehteh_: any interpreter should be fine
05:13 PM cehteh_: except AVR's are pretty memory constrained
05:13 PM dgriffi: it's the memory access that gives me pause
05:13 PM twnqx: nah
05:13 PM twnqx: it's easy
05:14 PM cehteh_: memory access on AVR's is 1 cycle (except eeprom on non -0 -1 series)
05:14 PM twnqx: i think the biggest 8bit AVR i used had 128k rom and 32k ram
05:14 PM twnqx: cehteh__: or with external ram :P
05:14 PM dgriffi: 32k ram should be enough for a V3 game
05:14 PM cehteh_: the mrain reason that AVR's are not available in faster speeds is that they are sync with sram and flash
05:14 PM twnqx: i think the chip had 4k and i glued an extra 32k on
05:15 PM twnqx: eh, there's 7ns sram
05:15 PM dgriffi: did the extra 32k appear as part of main memory?
05:15 PM twnqx: that is no excuse!
05:15 PM twnqx: yeah
05:15 PM dgriffi: oh... I was under the impression you had to manually move stuff in and out of external ram
05:15 PM twnqx: not all chips can to that, though
05:15 PM cehteh_: actually only a few AVR's
05:16 PM cehteh_: when you need that AVR' is prolly not the best choice
05:17 PM twnqx: anything beyond the at90 series?
05:19 PM cehteh_: twnqx: flash and sram .. and need to be manufactured on the same die in the same cheap process
05:21 PM TechChristoph: i try to figure out how to programm with ones and zeros
05:21 PM twnqx: hm, programming AVR with punchcards
05:21 PM TechChristoph: i know on the avr there is hexcode
05:22 PM TechChristoph: should be very hard to learn
05:22 PM twnqx: "hexcode"?
05:22 PM cehteh_: TechChristoph: i wanted to make a punchtape reader with microswitches and a crank to program AVR's
05:22 PM TechChristoph: mhm how can i get 0 and 1 into a mcu ?
05:23 PM cehteh_: thats not so complicated, but the trick lies on making the tape punch machine
05:23 PM TechChristoph: i know there is assembly
05:23 PM twnqx: given the programming protocol for AVRs is SPI... not difficult, just slow.
05:23 PM TechChristoph: but what is underneath assembly?
05:23 PM cehteh_: read the datasheet about serial/parallel programmign
05:23 PM twnqx: TechChristoph: underneath is basically the instruction encoding
05:23 PM cehteh_: in the easiest an crapiest way you can program it with flip switches and a button
05:24 PM TechChristoph: and underneath that ?
05:24 PM twnqx: nothign
05:24 PM twnqx: binary (1s and 0s) is just a different notation from hex
05:24 PM twnqx: base 2 versus base 16
05:24 PM dgriffi: I remember someone programming an EPROM like that... or attempting to do so.
05:24 PM TechChristoph: yeah i want get to the binary-state
05:24 PM cehteh_: well programming the AVR's uses some kind of protocol
05:24 PM twnqx: there is no "binary state"
05:25 PM dgriffi: address switches, data switches, and a "burn" switch
05:25 PM twnqx: like i said it's just a different way to spell out the number
05:25 PM cehteh_: read thh avr risc architecture manual
05:25 PM twnqx: and the avr is an 8 bit cpu
05:25 PM TechChristoph: i mean there where people in the 50s or 60s
05:25 PM TechChristoph: they had no assembly language right ?
05:25 PM cehteh_: http://ww1.microchip.com/downloads/en/devicedoc/atmel-0856-avr-instruction-set-manual.pdf
05:25 PM cehteh_: there you go
05:25 PM TechChristoph: so how did they made the first assembler ?
05:25 PM twnqx: i would assume they had one
05:25 PM twnqx: just no computerized assembler, so they assembled themselves
05:26 PM TechChristoph: but someone had to make the first right ?
05:26 PM twnqx: i thin i did that myself at some point
05:26 PM twnqx: write out the program in assembly, look up the encoding in tables
05:26 PM cehteh_: TechChristoph: i strongly recommend to read the risc-v reader because that arch is extremely nice, a small book and you learn almost everything about the architecture
05:26 PM twnqx: note the hex numbers down with the instructions
05:26 PM cehteh_: TechChristoph: https://www.amazon.de/David-Patterson/dp/0999249118/
05:27 PM TechChristoph: yeah its all instructions
05:27 PM twnqx: if you really feel the need, convert them to binary
05:27 PM TechChristoph: but if i want to make instructions by myself
05:27 PM cehteh_: actually you should start with some open architecture when you want to know these details
05:27 PM twnqx: you can't, those are given
05:27 PM twnqx: unless you build your own cpu
05:27 PM cehteh_: don knuth mmix might be a good starting point as well
05:27 PM TechChristoph: ah ok
05:28 PM cehteh_: https://de.wikipedia.org/wiki/MMIX
05:28 PM cehteh_: you are swiss-german?
05:29 PM TechChristoph: i am
05:29 PM TechChristoph: why ?
05:29 PM cehteh_: becasue i linked the german page :D
05:29 PM TechChristoph: :)
05:29 PM cehteh_: well get the risc-v reader i linked first its really nice to read
05:30 PM cehteh_: and its an actual arch that gets some traction now
05:30 PM TechChristoph: how many pages
05:30 PM cehteh_: approx 100
05:31 PM cehteh_: its insane ... risc-v is so well done that the whole thing can be described in 100 pages
05:31 PM TechChristoph: oh ok :) i can do it
05:31 PM cehteh_: while i have the intel manuals (from about 15 years ago) here, they fill a whole booshelf
05:32 PM cehteh_: meanwhile intel doesnt print/ship them anymore because its too much bloated :)
05:33 PM TechChristoph: i worked with logic gates times ago
05:33 PM TechChristoph: maybe i have to take a eeprom
05:34 PM TechChristoph: to design commands maybe
05:34 PM twnqx: go with modern days, use an fpga
05:34 PM TechChristoph: yeah i know
05:34 PM TechChristoph: but for the fun of it
05:34 PM twnqx: eeproms are too smal
05:34 PM TechChristoph: otherwise i have a language called vhdl in between
05:34 PM twnqx: though you could probably to something with enough of them
05:35 PM TechChristoph: just for testing
05:35 PM twnqx: i am the verilog not vhdl type of fpga programmer, but yeah
05:37 PM TechChristoph: maybe eeproms an adders
05:37 PM TechChristoph: i will have a look
05:37 PM TechChristoph: project for the next holidays
05:38 PM TechChristoph: or weekend
05:42 PM TechChristoph: cehteh_, you are swiss-german too ?
05:42 PM twnqx: on 64kx8 plus one 64kx1 eeprom can make an 8-bit-adder
05:42 PM cehteh_: nope german-german :D
05:42 PM twnqx: nah, he's just german i guess :P but we can see your .ch ISP
05:42 PM TechChristoph: i see :)
05:43 PM TechChristoph: yep
05:43 PM TechChristoph: its my provider
05:43 PM TechChristoph: oh german is a big language
05:43 PM cehteh_: but with swiss you never know if one speaks french, italian or romanic
05:43 PM twnqx: though your last name rather points to the swiss-french part
05:43 PM TechChristoph: oh it depends
05:44 PM TechChristoph: if you are from the swiss-german-part you speak swiss-german
05:44 PM cehteh_: i know
05:44 PM TechChristoph: if you are from the swiss-french-part you speak french
05:44 PM TechChristoph: and so on
05:45 PM TechChristoph: but swiss-german well, its mor about dialects than a language
05:45 PM twnqx: and everyone speaks english!
05:45 PM TechChristoph: are you sure ?
05:45 PM cehteh_: quite strange dialect :) often hard to understand for germans
05:45 PM TechChristoph: well 26 dialects :)
05:45 PM cehteh_: i am from north germany, but had some swiss friends so i can understand it
05:46 PM cehteh_: and living more in the south now
05:46 PM TechChristoph: ok
05:46 PM twnqx: 26! i didn't know that
05:46 PM TechChristoph: so maybe we have lets say 400 dialects
05:46 PM twnqx: i could mostly understand those i heard so fr
05:47 PM cehteh_: while 'plattdeutsch' from the north is rather a language than a dialect :)
05:47 PM TechChristoph: because even in small villages one word has other meaning than in others
05:47 PM cehteh_: also in 100's variations
05:47 PM TechChristoph: yep
05:48 PM TechChristoph: and we have also italian
05:48 PM TechChristoph: and they have also dialects
05:48 PM TechChristoph: a bit weird i know
05:49 PM twnqx: not really, we also have quite a bit of dialects, and some could as easily be a different language
05:50 PM TechChristoph: twnqx, so you're italian ?
05:50 PM twnqx: nah, german, too
05:50 PM TechChristoph: ah ok
05:51 PM cehteh_: well swiss has romansh as 4th offical language as well
05:51 PM TechChristoph: yes
05:51 PM TechChristoph: since the 1930's
05:51 PM cehteh_: and whenever you want to confuse a german-german, you change his keyboard layout to swiss-german
05:51 PM TechChristoph: :)
05:51 PM cehteh_: its has the right sublety of differences to make real shit
05:52 PM TechChristoph: i use the english-layout for programming and the swiss-german for irc or some openoffice-work
05:52 PM twnqx: back in my juvenile days, i confused my teacher with a DOS "terminate and stay resident" program that would randomly, once, swap neighboring keys
05:53 PM twnqx: and then select a different pair of keys to swap
05:53 PM TechChristoph: forkbombs ?
05:53 PM twnqx: he never realized what was going on
05:53 PM twnqx: nah, just annoying someone by causing typos for no reason
05:54 PM cehteh_: in a unix course i created a file with the name XXXXXXX<control sequence to clear the screen>
05:54 PM TechChristoph: was it funny ?
05:54 PM cehteh_: whenever one did 'ls' it cleared the screen
05:54 PM cehteh_: back on ancient (iirc hp-ux)
05:54 PM cehteh_: nowadays thats luckily not possible
05:55 PM twnqx: are you sure? :>
05:55 PM cehteh_: touch "XXXXXXXX$(clear)"
05:55 PM cehteh_: try it
05:55 PM cehteh_: well i am on linux
05:56 PM cehteh_: dunno about current hpux
05:56 PM cehteh_: $ ls XXXXXX*
05:56 PM cehteh_: 'XXXXXXXX'$'\033''[H'$'\033''[2J'
05:56 PM cehteh_: gnu escapes weird stuff
05:57 PM twnqx: boring
05:57 PM cehteh_: touch '*'
05:57 PM cehteh_: figure out how to remove that :D
05:57 PM cehteh_: w/o deleting anything important
05:58 PM twnqx: just use '*'?
05:58 PM twnqx: or turn off globbing if you're scared :P
05:58 PM cehteh_: :)
05:59 PM twnqx: int main () { unlink ("*"); return 0; }
05:59 PM twnqx: :P
05:59 PM cehteh_: there where some other such things
05:59 PM cehteh_: of course its possible, but easy to do it wrong
06:00 PM cehteh_: inless windows which once could produce filnames which where not deleteable HAHA
06:00 PM twnqx: i once grepped a password list from a raw device after accidental rm -rf, i know what you mean
06:02 PM dgriffi: ever have a file with a null name?
06:03 PM dgriffi: I'm told that can happen from bizarre malfunctions of NFS and/or window shares
09:35 PM rue_mohr: NFS cannot properly detect versions, make COMPLETELY sure your NFS is the same version on each end
11:50 PM day_ is now known as day