#avr Logs

Mar 04 2018

#avr Calendar

12:41 AM rue_shop3: general check, activate all the columns and look at all the rows, to see if *any* key is down
12:44 AM rue_shop3: if so, THEN scan it
12:46 AM nuxil: yea im just done writing the code. gonna test it soon. just need 1 more cup of coffee 1st:p
12:46 AM nuxil: https://pastebin.com/Pgh0yDVn
12:47 AM nuxil: that should work right
12:51 AM _abc_: Has anyone seen a problem which consits of: linux platform, avrdude driven by makefile, usbasp programmer, various targets, atmega8 168 328 etc
12:51 AM _abc_: Programming always (always) fails with timeout on the 1st 3-4 runs of avrdude, then succeeds.
12:52 AM _abc_: The 1st 3-4 times get stuck at successively later points in the upload, as shown by the progress bar
12:52 AM nuxil: i have all above except a usbasp. im using linuxspi and dont have such issues.
12:53 AM nuxil: what baudrate are you running at ?
12:53 AM _abc_: It does not matter if, after that, if I upload the same code or another, it no longer gets stuck for a work day. My hunch is, some critical timing somewhere in v-usb and or avrdude related to initial startup io buffer allocation?
12:53 AM _abc_: nuxil: there is no 'baud rate' with usbasp, it is not serial model
12:54 AM _abc_: I tried slow and fast write speeds, does not matter
12:54 AM _abc_: Note that the usbasp fw is the kind which says "can't set the spi clock rate"
12:55 AM _abc_: It could be in usbasp internally but that is very, very unlikely. I tried to heat/cool it etc, no change.
12:56 AM _abc_: Also I have two and they behave exactly the same
12:56 AM nuxil: baudrate is a unit of data transfere speed. ofc you can mesure datatransfere over usb in baud if you like :p
12:56 AM nuxil: anyway
12:56 AM nuxil: have you tried using the -C option
12:56 AM nuxil: or wheverever it was
12:56 AM _abc_: no. What does -C do please?
12:57 AM _abc_: Config file?!
12:57 AM nuxil: i meant -B
12:57 AM _abc_: I tried to tweak the cli params a lot, yes
12:57 AM _abc_: Of course I used -B but see above. The fw does not permit this setting.
12:57 AM nuxil: -i ?
12:58 AM _abc_: All of them. Note -i does nothing with usbasp
12:58 AM nuxil: well.
12:58 AM nuxil: get a hammer and smash it :p
12:59 AM _abc_: I used -B 10 -B 20 -i 1 etc. It slows down programming a lot, going from 10 to 11 or so, but no change in the real problem
01:00 AM nuxil: :(
01:00 AM _abc_: Anyway, will lurk some more, maybe someone ran into this
01:00 AM nuxil: only on linux ou got this issue ?
01:01 AM _abc_: The strange part is, after it succeeds to burn one part completely, i.e. after 3-4 initial getting stuck tries, it always works great, with any part, and any code to burn. It even works fine after I disconnect and reconnect the usbasp on usb!
01:01 AM _abc_: nuxil: I do not use non linux os in this context.
01:01 AM _abc_: So whatever the problem is, it is likely in the kernel on the linux side, although I changed kernel major number 2 to 3 and same outcome most of the time
01:03 AM nuxil: try something as silly as swap usb port
01:04 AM _abc_: nuxil: tried. Also using an external hub
01:05 AM _abc_: nuxil: this is 99% an untractable v-usb problem
01:05 AM _abc_: Meaning, likely in combination with my hardware and or avrdude version
01:09 AM nuxil: did you try using lufa instead ?
01:09 AM _abc_: I think usbasp uses lufa I just call it v-usb which is, I think, the new name of the same thing
01:09 AM _abc_: Let's let it rest until others chip in nuxil. Thanks for the help.
01:09 AM nuxil: oh. i thought lufa and v-usb was 2 different project
04:38 AM xoomas: hi
05:02 AM xoomas: who can bit explain how i2c eeprom address works
05:02 AM xoomas: there is byte write and page write
05:03 AM xoomas: both have word address
05:13 AM polprog: what eeprom
05:24 AM antto: spi is so much simpler
05:24 AM antto: i couldn't get i2c working
05:25 AM polprog: i got it working once
05:25 AM xoomas: i think i already know answer
05:25 AM xoomas: :)
05:25 AM xoomas: eeprom is 24c08
05:26 AM xoomas: so you have to use device address byte + byte address
05:26 AM polprog: thats a very popular eeprom
05:28 AM polprog: http://ww1.microchip.com/downloads/en/devicedoc/21081G.pdf
05:28 AM antto: justin bieber is also very popular..
05:28 AM polprog: page five
05:29 AM xoomas: yes
05:30 AM xoomas: first i just thought that there is just like user selectable address for device ;)
05:30 AM polprog: yeah thats how its usualy done
05:30 AM polprog: but they kinda abuse the "standard"
05:30 AM polprog: weird way to do it
05:31 AM xoomas: but not in 04 or bigger eeproms
05:31 AM polprog: but its a very old chip, so they might have been first, then the defacto standard formed
05:31 AM polprog: who knows
05:31 AM xoomas: still have to deal with them :)
05:31 AM xoomas: want to try make eeprom programmer ;)
05:32 AM polprog: i think i have one 24cXX chip
05:32 AM xoomas: i have a lot of them :)
05:32 AM xoomas: they are everywhere :D
05:33 AM polprog: ikr
05:33 AM xoomas: but for me interesting part is to make programmer
05:33 AM xoomas: not becouse i need it
05:33 AM xoomas: i have like 3 or 4 programmers :D
05:33 AM xoomas: who can read them :)
05:33 AM polprog: brb
05:34 AM polprog: make clean litterbox
05:34 AM * Xark notes you might need sudo for that. :)
05:37 AM nuxil: xoomas, didnt you get the i2c lib to work ?
05:40 AM _ami_: xoomas: using i2c hw or i2c bitbang?
05:40 AM nuxil: xoomas, in short. the last bit of the address desides if you write or read to the device. so you usaly start doing either ret = i2c_start(THA_ADDRESS+I2C_WRITE); or i2c_start(THA_ADDRESS+I2C_READ);
05:41 AM polprog: + or |
05:41 AM _ami_: i wrote one bit bang code few months before.
05:41 AM polprog: id feel more confortable ORing
05:41 AM _ami_: xoomas: http://www.enlightenment.org/ss/e-5a9bdb34a0d434.90138966.png
05:41 AM nuxil: i bitbanged spi over i2c :D
05:42 AM polprog: what editor is that lol
05:42 AM polprog: status bar looks like emacs but the rest looks like vim
05:42 AM _ami_: polprog: vim :)
05:43 AM polprog: stdio.h is that your own header or a standard one on avr
05:44 AM nuxil: standard io
05:44 AM nuxil: ?
05:44 AM polprog: yeah i know
05:44 AM polprog: wait
05:44 AM _ami_: avr header. needed it for sprintf
05:44 AM polprog: i used that before lol
05:44 AM polprog: sorry, brainfart
05:45 AM _ami_: this code was for attiny13a
05:45 AM _ami_: i was testing my i2c code across different i2c slaves.
05:46 AM polprog: on friday i was bored at the programming class
05:46 AM polprog: so i tested my inline assembly snippets under windoze
05:47 AM _ami_: theory on programming is always boring :)
05:47 AM _ami_: was it a practical programming class?
05:47 AM polprog: you would wish it was theory
05:47 AM polprog: you would wish it was a real programming class
05:47 AM _ami_: :)
05:48 AM polprog: im walkling around helping to start the ide
05:48 AM polprog: correcting syntax errors
05:48 AM polprog: anyway
05:49 AM nuxil: u fool :p
05:49 AM polprog: it worked :D https://puu.sh/zAjMt/5754d15416.png
05:49 AM nuxil: now they always come to you when they need help :p its gonna get annoying for you in the long run :p
05:49 AM _ami_: eew! conio.h :P
05:49 AM polprog: _ami_: eew indeed
05:49 AM polprog: you know why
05:49 AM _ami_: for getch() crap :D
05:49 AM polprog: yes
05:49 AM polprog: you know what getch does accrding to the teacher
05:50 AM polprog: ?
05:50 AM _ami_: what did teacher say? :)
05:50 AM polprog: it waits for the user to press a key and then closes the program
05:50 AM polprog: top kek
05:50 AM nuxil: umm
05:50 AM nuxil: 'lol
05:50 AM _ami_: haha.
05:50 AM polprog: yeah
05:51 AM nuxil: well he got 1/2 of it right tho :p
05:51 AM polprog: she just copies the examples from the book onto the whiteboard
05:52 AM polprog: every classrom but the computer lab has a beamer connected to the pc
05:52 AM polprog: and there are syntax errors on the bloody whiteboard
05:52 AM polprog: people are getting errors on cin and cout if they dont copy and paste "the program header"
05:53 AM polprog: which is a bunch of includes like cstdio, iostream, conio and then using namespace std
05:53 AM _ami_: you were hero in the class :) since you were helping others in fixing their code?
05:53 AM polprog: kindof
05:54 AM _ami_: i know that feelings :)
05:54 AM polprog: fortunately the rest of the teachers knows their shit
05:54 AM polprog: maths is very well taught
05:54 AM polprog: :)
05:54 AM polprog: for example
05:55 AM _ami_: well, i think they know stuffs. its just that they don't give a shit
05:55 AM xoomas: nuxil not only read write on that byte
05:55 AM xoomas: there is also data address for higher eeproms
05:55 AM polprog: i think shed doesnt know stuffs
05:55 AM polprog: :(
05:55 AM _ami_: oh
05:57 AM _ami_: you already know way better than her.
05:57 AM _ami_: btw what is she teaching? only programming?
05:57 AM polprog: programming and "IT"
05:58 AM polprog: IT being a subject where you learn office etc
05:58 AM polprog: IT is a vey useful subjeect
05:58 AM polprog: people need to know how to use excel for example
05:58 AM polprog: or how to format text in word
05:58 AM _ami_: :P
05:58 AM _ami_: bogus
05:58 AM polprog: it is a complete alien world for us who have used computers every since we were kids
05:59 AM polprog: i got my first laptop with win98 when i was in preschool
05:59 AM polprog: it was a hp my dad gave me when he got a better one.
05:59 AM polprog: but most young people have no idea how to use computers
06:00 AM polprog: http://www.coding2learn.org/blog/2013/07/29/kids-cant-use-computers/
06:00 AM polprog: [skip the Net neutraility popup he put there]
06:07 AM polprog: oh, so that lesson on office suite is called "ICT"
06:07 AM polprog: til
06:13 AM xoomas: _ami_ why your eeprom address is 0x57?
06:13 AM Tom_L: you gotta live somewhere!
06:13 AM xoomas: i see taht you use e0 e1 e2 pins as high
06:15 AM Tom_L: polprog, you got the same instructor as x999?
06:16 AM polprog: Tom_L: possibly the same soul in two bodies on two ends of the world
06:16 AM polprog: with the difference being thta i luckily managed to learn this myself
06:16 AM polprog: its sad
06:16 AM Tom_L: where did all the real teachers go....
06:17 AM polprog: aware people go to well paid work, clueless people become teachers, the most clueless people teach teachers
06:18 AM xoomas: :D
06:19 AM xoomas: im not aware :D
06:19 AM polprog: if i ever was to become teacher, that would be just because i like sharing knowledge
06:19 AM polprog: because in poland, and probably the rest of the world
06:19 AM polprog: teachers make shit money
06:21 AM xoomas: here too
06:22 AM xoomas: here was (forgot word) when they stop working
06:22 AM xoomas: to show goverment that they want more money
06:22 AM xoomas: :)
06:23 AM polprog: strike?
06:23 AM xoomas: ah yes
06:23 AM xoomas: almost same word in lithunia ;D
06:23 AM xoomas: streikas :)
06:23 AM polprog: same word in polish as wel, strajk
06:27 AM polprog: the only issue i have with that article is that he is partonizing IT
06:27 AM polprog: thats just crigy, but the general idea is right
06:31 AM nuxil: i ordered a new mat for my computer desktop 40x90 cm :)
06:32 AM nuxil: https://www.ebay.com/itm/Command-Center-World-Mouse-Mat-World-View-Mouse-Mat-Gaming-New-S-M-L-Sizes/222552976575?ssPageName=STRK%3AMEBIDX%3AIT&var=521396479142&_trksid=p2060353.m2749.l2648 :D
06:32 AM nuxil: *desk -top
06:33 AM nuxil: now i can make real plans on how to take over the world :D
06:33 AM nuxil: muhahah
06:58 AM antto: polprog i am seeing the same thing, and worried about the same things too
06:58 AM xoomas: _ami_ you still here?
06:59 AM antto: as what this guy talks about in that link you posted
06:59 AM antto: everybody and their grandma uses some sort of "computer" and they know nothing about them at all
07:30 AM polprog: nuxil: nice mat
07:31 AM nuxil: :)
08:16 AM xoomas: _ami_ im trying your code
08:16 AM xoomas: but bit dont get it about addressing still
08:17 AM xoomas: looks like you send 2 bytes for address
09:08 AM xoomas: hmm i know what to do but dont know how ;D
11:24 AM atk is now known as oop
11:25 AM oop is now known as atk
11:27 AM arduiko: nuxil are you reading arduino forum as an avr user ? you told me that my posts were removed, how did you know :o
11:27 AM xoomas: hmm
11:28 AM xoomas: now need to make some kind command acceptance in avr from uart
11:28 AM xoomas: :)
11:28 AM arduiko: lol
11:29 AM xoomas: hmm
11:29 AM xoomas: RXCIE
11:30 AM xoomas: it triggers when receives some data from usart?
11:45 AM rue_bed: a byte yea
11:46 AM rue_bed: er, that should be rxie
11:46 AM rue_bed: whats the c for?
11:57 AM xoomas: complete
11:57 AM xoomas: hmm now thinging how it handles more then one byte
11:58 AM polprog: UDR
11:58 AM polprog: usart data register
11:58 AM polprog: what chip are you using?
11:59 AM xoomas: atmega8
11:59 AM xoomas: but udr is 8bit
11:59 AM polprog: looking for the 9th bit?
12:00 PM xoomas: what if i want to send array
12:00 PM polprog: page 136
12:00 PM xoomas: idea is to make some kind protocol :D
12:00 PM polprog: while(!sent){ send bit; wait til ready }
12:01 PM polprog: or rather
12:01 PM polprog: send bit after bit
12:01 PM xoomas: page 136 shows Uart init
12:02 PM xoomas: i want to send commands from PC
12:02 PM xoomas: to atemga
12:03 PM polprog: wrtining to UDR == send from avr - reading UDR == reading data received
12:03 PM xoomas: yes i know that
12:03 PM xoomas: and its 1 byte
12:03 PM polprog: and you want to receive a string of bytes?
12:03 PM xoomas: yes
12:04 PM xoomas: i guess i should do a loop
12:04 PM * antto whispers: something something interrupt. something something fifo
12:05 PM polprog: interrupts are better, but loop is simpler
12:05 PM xoomas: now im iterrupting on rxcie
12:05 PM antto: keep that then, add a fifo to it and then poll the fifo from the main thread
12:05 PM xoomas: how that fifo looks in c
12:05 PM xoomas: :)
12:06 PM xoomas: its like data = udr<<8?
12:06 PM polprog: usually an array with two pointers
12:06 PM xoomas: i think it should be buffer
12:06 PM antto: a buffer/queue, where the first element that got in is the first element that should get out (FIFO - first-in, first-out)
12:06 PM polprog: one pointer "catches" another
12:07 PM xoomas: i know what fifo means :)
12:07 PM xoomas: but dont know how it looks in C
12:07 PM xoomas: :))
12:07 PM antto: there were some examples on avrfreaks
12:07 PM cehteh: an array and some accessor functions
12:08 PM polprog: sounds like the same chords, they sythed a very similar tone as well
12:08 PM xoomas: i not remember how to fill buffer ;))
12:08 PM polprog: wrong chan sorry
12:08 PM antto: i have an attempt to make a fifo using templates (C++) for atmegas
12:09 PM antto: ehm, it was actually a combined usart+fifo transmit/receive (interrupt driven in both directions)
12:09 PM xoomas: PORTB ^= (1<<PB0);
12:09 PM xoomas: command = UDR;
12:09 PM xoomas: now im only doieng this in interrupt
12:10 PM cehteh: C++ would only complicate it :D
12:10 PM antto: the implementation looks complicated
12:10 PM antto: the usage doesn't ;P~
12:11 PM antto: and supposedly it should generate very tiny code, if i've done the template metavoodoo right
12:11 PM cehteh: xoomas: instead reading into a single command variable you use a small queue there
12:12 PM xoomas: cehteh problem is that i barely remember C :)
12:12 PM cehteh: time to learn :D
12:12 PM xoomas: 5 years ago programmed in C for AVR
12:12 PM xoomas: learning is doing
12:12 PM xoomas: if i see example i do it ;D
12:12 PM antto: isn't it like riding a bike? you can't just completely forget it all
12:12 PM xoomas: just need hint
12:12 PM xoomas: :D
12:13 PM xoomas: its like riding a bike without hands
12:13 PM xoomas: but if you never learned to ride without hands
12:13 PM xoomas: you can still ride
12:13 PM xoomas: but not cool :D
12:14 PM xoomas: so im in this possition :D
12:14 PM antto: "look mom! one hand!" .... "look mom, no ha"BAM!
12:14 PM xoomas: o more likeli i can push bike along me ;D
12:14 PM xoomas: :D
12:14 PM cehteh: http://git.pipapo.org/?p=muos;a=blob;f=src/muos/lib/cbuffer.c;h=71ec155ff3b48a89aad1d38e5e8f771e492358f4;hb=36a2eb6560080ac1a2e95b038205d963197e387e
12:14 PM cehteh: may give you some hints
12:15 PM cehteh: http://muos.pipapo.org/muos_manual.html#_cbuffer i even written docs for it :)
12:18 PM polprog: wow
12:18 PM xoomas: its very dont know how to say :D
12:18 PM xoomas: pop push peek
12:18 PM xoomas: :D
12:19 PM polprog: thats usual names :D
12:19 PM xoomas: thats why im pushing my bike ;D
12:20 PM xoomas: i guess i should use push function too ;D
12:22 PM xoomas: thats very advanced
12:22 PM xoomas: im barely can read it ;))
12:22 PM cehteh: huh? :)
12:22 PM cehteh: i tried to give you my simpest example :D
12:24 PM polprog: how i did receiving commands from a PC was that an ISR on recv complete monitored for a command delimiter (\n), copied the buffer and set a global flag. otherwise it wrote to the buffer and incremented the address
12:24 PM polprog: then a loop in main called the huge command processing func
12:24 PM polprog: with all the strcmp_P funcs
12:25 PM polprog: later during my internship i learnt a lot about finite state machines
12:25 PM polprog: and turned out i already wrote one but didnt know it was an FSM :D
12:26 PM xoomas: cehteh i i copyed that info to txt :))
12:26 PM polprog: look mom, malloc!
12:26 PM xoomas: when ill be driving bike without hands.. :D
12:26 PM polprog: look mom, null termination%^$&^Gvjujykv cmasd
12:27 PM xoomas: :S
12:27 PM polprog: that bug was quickly fixed
12:27 PM xoomas: i already blinking led when writing to terminal :D
12:28 PM xoomas: btw but still i have to be in main loop
12:28 PM xoomas: for parsing commands
12:28 PM xoomas: if i remeber correctly its bad to be long time in ISR
12:38 PM cehteh: xoomas: actually that cbuffer is from my uart stuff too :D
12:38 PM xoomas: :)
12:39 PM cehteh: but when you feel for something more complicated take a look at the txqueue stuff :D
12:39 PM polprog: take a look at assembly :D
12:39 PM xoomas: + problem is when i dont know english well
12:39 PM polprog: esp x86 one :{
12:39 PM polprog: :P*
12:39 PM xoomas: like "poke"
12:40 PM cehteh: instead having a big char by char buffer for sending to uart i have 2 queues, one stores data in a more compact (partial binary) format and a short (as small as 4 bytes only) for the interrupt handler to send by the uart
12:40 PM xoomas: i feels its to add value in to buffer
12:40 PM polprog: usually when you poke something it can fall out
12:40 PM polprog: but that doesnt make much sense really
12:41 PM cehteh: you possibly only need the simple push and pop functions
12:41 PM polprog: for example POKE in BASIC writes to a memory address...
12:41 PM cehteh: thats what the poke there does to, in place modification of the buffer content
12:41 PM polprog: ah
12:41 PM cehteh: the txqueue stuff needs that
12:41 PM polprog: damn
12:41 PM xoomas: ok
12:41 PM polprog: poke != pop lol
12:41 PM lvlinux: Anybody know how I can convert intel hex to ascii hex with ONLY the hex data in order? My programmer only accepts the raw data in ascii hex format (no address locations, no line numbers, no length/checksums, etc.)
12:42 PM xoomas: when you sayed about basic
12:42 PM polprog: lvlinux: objcopy can do raw format as well
12:42 PM polprog: iirc
12:42 PM xoomas: i remebered taht i last night watched 8bit guy
12:42 PM xoomas: :D
12:42 PM xoomas: he wrote something with poke
12:42 PM xoomas: :))
12:42 PM lvlinux: polprog: ok I'll check that out thanks.
12:42 PM cehteh: peek/poke :)
12:42 PM xoomas: peek is to see whats inside? :D
12:43 PM cehteh: yes
12:43 PM cehteh: again you dont need that for a simple queue
12:43 PM polprog: in C64 if you knew the right address you could eg. change the screen color
12:43 PM xoomas: now imagine how hard for me is to read your code :D
12:43 PM xoomas: but atleast i have that feeling :D
12:43 PM xoomas: when i feen it can be that :)
12:44 PM xoomas: i guess i only need push and pop
12:44 PM cehteh: yes
12:45 PM cehteh: have you seen the sliding-window-priority-queue implementation there? :D
12:45 PM xoomas: not yet :D
12:46 PM xoomas: dont even imagine what is that ;D
12:46 PM cehteh: http://muos.pipapo.org/muos_manual.html#_spriq
12:46 PM cehteh: there is only push and pop .. but the implementation is a bit more complicated
12:46 PM xoomas: btw that OS works on avr/
12:47 PM cehteh: http://git.pipapo.org/?p=muos;a=blob;f=src/muos/lib/spriq.c;h=547bbfc6afef3a5b57e131d48705da88361f5982;hb=36a2eb6560080ac1a2e95b038205d963197e387e
12:47 PM cehteh: well it doesnt really look complicated
12:47 PM cehteh: yes, down to tinys (with some features disabled)
12:48 PM cehteh: havent worked on it for some time, should continue on it
01:08 PM xoomas: its some kind like rtos? :)
01:13 PM xoomas: hmm cant compile it :)
01:13 PM xoomas: and not very familiar with struct
01:13 PM xoomas: cehteh can you help a bit to adapt your code ;)
01:19 PM xoomas: https://stackoverflow.com/questions/11657629/avr-c-programming-global-arrays
01:19 PM xoomas: this looks simpler ;D
01:19 PM xoomas: but not sure how it gets legth
01:22 PM cehteh: wont compile as is, because it needs some infrastructure, i only shown it to get an idea
01:22 PM cehteh: needs -std=c99 at least
01:23 PM xoomas: will be too hard to remake :D
01:23 PM xoomas: what about that link i pasted
01:23 PM xoomas: getData
01:24 PM xoomas: only one think not clear
01:24 PM xoomas: int responseLen = USART1_RX();
01:24 PM xoomas: i guess its data from message
01:24 PM cehteh: thats not a queue and not using interrupts
01:24 PM xoomas: the length
01:25 PM cehteh: #define MUOS_ARRAY_ELEMENTS(array) (sizeof(array)/sizeof(*(array)))
01:25 PM cehteh: well thats not even needed since the buffer is byte based
01:25 PM cehteh: just sizeof() on the array will do the job
01:26 PM cehteh: or, statically define the size
01:26 PM cehteh: #define RX_BUFFER_SIZE
01:26 PM cehteh: char mybuffer[RX_BUFFER_SIZE];
01:27 PM cehteh: doesnt even need a struct
01:27 PM cehteh: you need to keep track for the first and last element, or first and (used)length, i do the later
01:27 PM nuxil: arduiko, because i was searching some stuff. and your name came up on the forum. i open the post in a tab. forgot about it. and next day when i refresed the tab just to see if anyone had replyed to your post but it was gone.
01:47 PM xoomas: btw
01:47 PM xoomas: abcminiuese
01:47 PM xoomas: r
01:47 PM xoomas: was creating wnavr?
11:14 PM nux_ is now known as nuxil
11:32 PM day__ is now known as day