#avr Logs

Mar 11 2017

#avr Calendar

12:42 AM Emil: yes
02:33 AM rue_shop3: Steffanx, well, you gonna topic the channel or what?
02:53 AM JanC is now known as Guest5212
02:53 AM JanC_ is now known as JanC
03:05 AM Steffanx: Im still not entirely sure what you are referring to rue_shop3
03:45 AM hetii: Hello again :)
04:03 AM Emil: I'll gladly take those topic rights if given
07:05 AM hetii: Emil, build it yourself :)
07:59 AM JanC_ is now known as JanC
08:03 AM hetii: Anyone familiar with LPCopen stack ?
08:03 AM hetii: I have such simple code to get data from spi: http://pastebin.com/4sFFtSXt
08:03 AM hetii: and only be able to get first byte if set: xf_setup.length = 1 :/
08:04 AM hetii: Here is the corresponding lib used by my example: http://pastebin.com/wSg1NLYg
08:46 AM Lambda_Aurigae: that's definitely not avr..hehe
08:47 AM Lambda_Aurigae: looks like it's for an arm processor...probably won't run at all on an avr.
08:49 AM hetii: well I use that code on LPC11c24
08:49 AM hetii: regarding avr also have some issue,
08:49 AM Emil: hetii: buold what myself?
08:50 AM hetii: as I notice i`m not able to receive all bytes correctly if my speed is above 860000Hz
08:50 AM Emil: hetii: you sure you responsed to the right person?
08:50 AM Emil: What the heck kind of speed is 860KHz
08:51 AM hetii: Emil, I thoguh that you say something about farmbot cnc from channel topic :)
08:51 AM Emil: Are you dedicating enough processing power to handling the spi bytes?
08:51 AM Emil: Are you overwriting buffers?
08:52 AM Emil: hetii: no I mean that I would like powers to change the topic
08:52 AM hetii: This is the code that I test for atmega8 with 16MHz crystal: http://paste.ubuntu.com/24157878/
08:53 AM hetii: atmega is connected to odroid xu4 via mosfet (k38) bss138 cause odroid can handle just 1.8v signals
08:54 AM Emil: wat. Odroid can handle 3.3v just fine.
08:54 AM hetii: XU4 ?
08:54 AM hetii: are U sure ?
08:55 AM hetii: t least on VDD_IO line he have 1.8v so I use it.
08:57 AM Emil: Oh
08:57 AM Emil: well that's shit :D
08:57 AM Emil: anycase
08:57 AM Emil: you also need to configure the avr's ss pin to output or have a strong pullup on it
08:58 AM hetii: but the avr works on slave mode
08:58 AM Emil: Oh okay
08:58 AM hetii: So I read everywhere that I should be able to transfer data fosck/4 for slave mode
08:59 AM hetii: but as I see have trouble to get stable link above this 860Khz
08:59 AM Emil: How do you measure 860KHz
08:59 AM Emil: What's your core speed?
08:59 AM hetii: 16Mhz for avr.
09:00 AM Emil: Sounds like you are dodoing something wrong
09:00 AM hetii: on odroid side I use py-spidev wrapper where I can define: spi.max_speed_hz so I put there 860000 value
09:01 AM hetii: for test I just run such simple loop: while(spi.xfer(range(255)) == ret2): pass
09:02 AM hetii: so it send 256 bytes and compare with ret2 that is also 256 bytes that I get from other right transfer
09:02 AM hetii: so for value above 860KHz after a while my loop break.
09:03 AM hetii: for below speed values It works more stable.
09:04 AM hetii: I also test attiny85 clocked at 20Mhz and using USI but works also not so stable.
09:05 AM hetii: I use around 15c of strip wire between my mcu and odroid so maybe here I have some issue.
09:06 AM hetii: *15cm
09:07 AM hetii: ok will back on half hour, if you have any idea what I can do more to have at least 2MHz link let me know :)
09:38 AM _ami_: is there any way to force gcc to keep an unused function in .text section even -ffunction-section is used as C flags?
09:39 AM _ami_: some __attribute__ ((?)) option?
09:46 AM hetii: _ami_, whats the purpose to have unused function ?
09:47 AM Tom_L: spare parts
09:47 AM _ami_: hetii: i am trying to override printf in newlib.. actually overriding _write() function so that printf sends output to uart!
09:48 AM _ami_: gcc optimizes binary and remove _write() from final elf.
09:49 AM hetii: I see
09:56 AM Emil: Hmm
09:57 AM Emil: If I have a dynamically switchable function, how do I tell gxc that dont remove this bro
10:23 AM _ami_: Emil: i think __attribute__((__used__)) should work
10:23 AM _ami_: google abt it1
10:42 AM Emil: _ami_: thanks
11:43 AM enhering: hi
11:50 AM homa_: hi
11:54 AM Lambda_Aurigae: I didn't do it!
11:55 AM homa_: Lambda_Aurigae: hi
11:57 AM homa_: my programmer is atmega8-16pu how can i update firmware
11:58 AM Lambda_Aurigae: does it have a bootloader?
11:58 AM Casper: you need another pogrammer to upgrade the firmware usually
11:58 AM Lambda_Aurigae: if not, you need another programmer device.
11:58 AM Casper: and usually you do not need to update the firmware, unless the chinese manufacturer really screwed up
11:58 AM Lambda_Aurigae: Casper, as I recall he has a really old and kinda off usbasp.
11:59 AM Lambda_Aurigae: with the wrong vid/pid
11:59 AM Lambda_Aurigae: have fun...I'm going to go buy a bicycle.
11:59 AM homa_: i'm from iran
11:59 AM Casper: which worry me... the vid/pid is in the firmware... why would they have modified the firmware?
12:00 PM Casper: homa_: so? where you live on earth change nothing on where the programmer was made
12:01 PM homa_: Casper: my programmer give me error about update firmware
12:01 PM homa_: avrdud
12:06 PM Casper: which firmware? the one you try to flash on your target? or the programmer own's firmware?
12:06 PM Casper: also, do you have the latest avrdude?
12:07 PM homa_: version avrdude is 6
12:12 PM Casper: 6.what?
12:15 PM Arlenx: hey guys, i'm trying to decode NEC protocol so i wrote this little code: http://pastebin.com/F1y0t1VK the problem is that it's not always capture the 9ms range, i need to press the remote button several times until i see it captured in phase_1 help please
12:22 PM homa_: Casper:
12:23 PM rue_bed: hmm
12:23 PM rue_bed: thats not sony is it
12:23 PM rue_bed: silly little puilses
12:23 PM rue_bed: phase encoded or something
12:24 PM rue_bed: you have waaaay too much junk in the isr
12:24 PM rue_bed: you have to keep them critically short
12:24 PM homa_: avrdude: warning: cannot set sck period. please check for usbasp firmware update.
12:24 PM homa_: avrdude: error: programm enable: target doesn't answer. 0
12:24 PM homa_: avrdude: initialization failed, rc=-1
12:24 PM homa_: Double check connections and try again, or use -F to override
12:24 PM homa_: this check.
12:24 PM rue_bed: set a flag and do the prints in the main loop
12:25 PM rue_bed: ah yea
12:25 PM rue_bed: what protrammer?
12:25 PM rue_bed: Arlenx,
12:25 PM homa_: me ?
12:25 PM rue_bed: ^^
12:25 PM rue_bed: Arlenx, ^^^^^
12:25 PM homa_: me ?
12:26 PM rue_bed: homa_, what rpogrammer?
12:26 PM homa_: rue_bed: i'm new
12:26 PM homa_: Bus 008 Device 002: ID 16c0:05e1 Van Ooijen Technische Informatica Free shared USB VID/PID pair for CDC devices
12:27 PM rue_bed: what kinda programmer is it
12:27 PM rue_bed: by general name
12:27 PM rue_bed: usbasp?
12:27 PM homa_: yes
12:27 PM rue_bed: ok, and what is the whole avrdude command your using
12:28 PM homa_: sudo avrdude -pm16 -cusbasp-clone
12:29 PM rue_bed: no
12:29 PM homa_: what ?
12:30 PM rue_bed: avrdude -c usbasp -P usb -p t26 -e -U flash:w:$(PRG).hex
12:31 PM rue_bed: do you understand the corrections?
12:31 PM Arlenx: rue_bed, o thanks
12:31 PM Emil: The fuck is -P usb
12:31 PM Emil: rue_bed: do you even avrdude?
12:31 PM rue_bed: yea
12:31 PM rue_bed: thats from my tiny26 makefile
12:32 PM homa_: rue_bed: avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp
12:32 PM homa_: my pid of device is 0x5e1
12:32 PM rue_bed: well then leave the -P and say asp-clone inseat
12:33 PM rue_bed: dont know how you manage a knockoff of an asp
12:33 PM rue_bed: as china is pumping out billions of them
12:34 PM homa_: doen't work
12:36 PM Emil: homa_: dont use -usb with usbasp
12:36 PM homa_: Emil: how ?
01:38 PM gamelaster: Hello, this is more "hardware" question, but IDK where to ask. I have ATmega32u4, and I bought by mistake 4-pin crystal instead of 2-pin. I can connect 4-pin crystal on it?
01:39 PM specing: why not?
01:39 PM specing: also the 4-pin crystal is probably crystal+oscilator circuit
01:40 PM specing: i.e. you get a clock out of it
01:40 PM specing: in this case you simply flash the AVR to use external clock
01:44 PM gamelaster: specing: hmm, second, I verify what I bought
01:44 PM gamelaster: Yup, it's crystal oscillator.
01:45 PM specing: and it only uses 1 pin
01:46 PM gamelaster: So now I wonder... How to connect it
01:46 PM specing: see above
01:54 PM Lambda_Aurigae: you have to supply VCC and GND to the oscillator
01:55 PM Lambda_Aurigae: there will be a clock out pin on the oscillator
01:55 PM Lambda_Aurigae: connect that to x1 in on the avr
01:55 PM Lambda_Aurigae: program avr fuses so said avr runs with external oscillator.
01:55 PM Lambda_Aurigae: much more detailed and I might as well build it for you
01:59 PM gamelaster: so connect XTAL1 to oscillator?
03:06 PM Casper: gamelaster: as per the datasheet
03:06 PM Casper: for external clock
03:06 PM gamelaster: Casper: thanks
03:07 PM Casper: gamelaster: basically, what you bought is a clock module instead of just the crystal
03:08 PM Casper: instead of buying a bell, you bought a module that have the bell, the microphone, the hammer and the ampli, all in a neat package that only miss a nice loop on top of it to make it cute
03:09 PM Casper: (and a crystal is like a bell, the avr normally send a power pulse to "knock" on it, and the crystal start to vibrate. The avr then receive that vibration and knock back at the right time to make the oscillation stronger and constant)
03:13 PM gamelaster: Casper: wow! Thanks for great explain ! So probably will be better to buy only a crystal
03:13 PM Casper: yes and no
03:13 PM Casper: the oscillator is actually a better solution
03:13 PM Casper: but more expensive
03:13 PM Casper: and take more board space
03:13 PM gamelaster: Casper: well, already I bought it
03:18 PM gamelaster: Casper: One more question, on my connection now I have it like this: http://i.imgur.com/Vupvias.png
03:18 PM gamelaster: I dont need anymore that 22pF capacitors?
03:22 PM Casper: no need for the 22, it's already provided inside
03:23 PM Casper: your module will need gnd + vcc, and a third pin is the clock out, feed that to the avr directly
03:24 PM gamelaster: Casper: And connect 5V from USB or from ATmegas VCC pin?
03:24 PM Casper: yes?
03:25 PM gamelaster: but which one?
03:27 PM Casper: which one what?
03:28 PM gamelaster: I have two 5V, one from VCC pin on ATmega, and one from USB (UVCC)
03:28 PM gamelaster: http://i.imgur.com/hNhawau.png (I changed it to this)
03:29 PM Casper: double check the datasheet for your oscillator, but should be to the same vcc as your avr
03:29 PM Casper: also
03:29 PM Casper: the one there have an enable pin, check to be sure that your part also have it, if so it may need to be tied to VCC
03:30 PM gamelaster: The component in eagle is same as my crystal oscillator, so it have EN
03:30 PM gamelaster: http://i.imgur.com/1ldGikv.png
03:31 PM Casper: yeah should be that
03:32 PM Casper: btw, there is a difference between "EN" and "/EN" the / mean 'reverse logic level' in that case to enable you need to bring it to gnd as it is active low
03:32 PM gamelaster: Casper: okay, give me moment, I look the schematics
03:34 PM gamelaster: From schematics: Logic 1 enables oscillator output, Logic 0 disables oscillator output, the oscillator output goes to the high impedance state. And No Connection enables oscillator output
03:34 PM gamelaster: so probably I don't need connect EN to VCC
04:19 PM Snert: EN is usually enable. So logic 1 enables the device so tie it to Vcc
05:30 PM Casper: gamelaster: you may not be required to connect it, but it is a good idea to connect it to be sure that there is no issue
05:30 PM gamelaster: Casper: Yep, I left it connected
05:31 PM gamelaster: now, I need just find out how modify and build Arduino Leonardo bootloader for support external clock. Do you have any tips, ideas or clues?
05:31 PM Casper: you do not
05:31 PM Casper: the application (or bootloader, which is just a special application) do not know what is the clock source
05:32 PM Casper: all you need to do is set the clock speed, which is used only for the timing, not for the code execution
05:32 PM Lambda_Aurigae: it just needs to know what the clock frequency is.
05:37 PM gamelaster: I need change AVR fuse, no?
05:41 PM Lambda_Aurigae: well, that's how you tell it to run from external clock, yes.
05:43 PM gamelaster: Lambda_Aurigae, and how I can do that?
05:43 PM Lambda_Aurigae: with an avr programmer
05:43 PM Lambda_Aurigae: bootloader can't change fuses.
05:44 PM Lambda_Aurigae: but, generally, bootloader can't reload a bootloader either
05:44 PM Lambda_Aurigae: so you are going to need an avr programmer of some sort.
05:45 PM gamelaster: I can use Arduino Uno as AVR ISP, no?
05:45 PM Lambda_Aurigae: in theory, yes
05:45 PM Lambda_Aurigae: I've never done it but others here have.
05:45 PM Lambda_Aurigae: I don't do anything with arduino at all ever.
05:47 PM gamelaster: but with AVR ISP I burning bootloader, or? (sorry, I have chaos on it, doing this first time so sorry for dumb questions)
05:47 PM Lambda_Aurigae: yes.
05:47 PM Lambda_Aurigae: you can burn a bootloader with an AVRISP
05:48 PM Lambda_Aurigae: and you can change fuses with it as well.
05:49 PM gamelaster: so, bootloader is absolutely separated from fuses? (whole time I thinking the fuses contains bootloader)
05:50 PM Lambda_Aurigae: bootloader can read fuses,,,if it is programmed to do so.
05:50 PM Lambda_Aurigae: bootloader absolutely can NOT write fuses.
05:51 PM Lambda_Aurigae: I recommend actually reading the datasheet for the microcontroller you are using..
05:51 PM Lambda_Aurigae: I know, people these days don't bother to read or learn step by step...just jump in with both feet and hope they don't drown.
05:52 PM Lambda_Aurigae: learn basic electroncs. learn digital electronics. then get into microcontrollers or complex things.
05:53 PM gamelaster: Lambda_Aurigae: that's true. Well, I'm same.
05:53 PM gamelaster: But primary I'm programmer, but I love to make "hardware" works with mine software, so I started prototyping hardware
05:53 PM Lambda_Aurigae: this is part of why I hate the arduino mindset...just grab an arduino and jump in with both feet.
05:53 PM Lambda_Aurigae: without understanding the underlying systems.
05:54 PM gamelaster: True, mainly when Arduino is so much slower than normal clean "C"
06:07 PM Emil: gamelaster: if you are a programmer you shouldn't have trouble reading the spec ;)
06:07 PM gamelaster: Emil: reading the specifications?
06:09 PM gamelaster: Emil: In low-level programming I'm not so good, I targeting mainly on high-level languages like PHP or NodeJS
06:10 PM Emil: Spec is spec, if you can read one you can pretty much read another
06:11 PM gamelaster: that's true
06:11 PM Emil: anycase
06:12 PM Emil: if you are interested in getting into actual avr coding you might like https://emil.fi/avr.txt (curl/wget-able)
06:13 PM Emil: Feedback welcome
06:13 PM gamelaster: whoah, nice! Thank you Emil!
06:14 PM gamelaster: btw. little tipo: breaboard
06:15 PM Emil: fixed!
06:15 PM Emil: Thanks
06:16 PM gamelaster: Your tutorial contains everything what I need to know! really big thanks for that, saving into bookmarks for hardware :-)
06:17 PM Emil: If you internalise that then you pretty much only need the basic datasheet for the chip (and especially the register descriptions) to get into it
06:17 PM Emil: fully
06:17 PM Emil: but I'm glad I could help
06:18 PM gamelaster: yeah! You helped a lot! :-)
06:22 PM Emil: Personally I recommend buying a small minimum development board (like an arduino) and coding it in pure C
06:23 PM Emil: but buying the raw chips and learning the electronics is also a good and valuable exercise, which allows you to make smaller and simpler devices instead of always throwing an arduino into it
06:23 PM Emil: The how to arduino is explained at the bottom (for serial bootloaders)
06:24 PM Emil: For usb isn't not much different
06:26 PM gamelaster: Emil: actually, I do with raw chip, doing whole scheme and board by myself, just I need to use Arduino Bootloader, because people which will use what I creating know "only" arduino
06:26 PM gamelaster: If I will can, I will use pure C
06:27 PM gamelaster: by the way, mine atmega32u4 have native USB support, but I anyway need ISP programmer?
06:27 PM Lambda_Aurigae: if you want to set fuses, yes.
06:27 PM Lambda_Aurigae: that chip might come with a usb bootloader onboard...can't remember.
06:28 PM Lambda_Aurigae: if it does, it is a DFU bootloader, not ardweeny
06:28 PM Lambda_Aurigae: you will need an ISP programmer or HVSP programmer to write a new bootloader to it.
06:28 PM gamelaster: yep, so anyway I need it
06:28 PM Lambda_Aurigae: your new bootloder will need to be written for that chip too.
06:29 PM Lambda_Aurigae: if it is going to use the usb interface anyhow.
06:29 PM gamelaster: yeah, I understand. Thanks for explain :-)
06:29 PM Emil: gamelaster: nah, you don't need to use arduino bootloader, either, you can specify that hey, program this through usbasp and so on
06:29 PM Emil: Through a serial bootloader is just so damn nice to have
06:30 PM * Lambda_Aurigae pats his enc28j60-avr ethernet bootloader.
06:30 PM Emil: gamelaster: burn bootloader and fuses once, reprogram through the bootloader as many times as you want
06:31 PM Emil: if the usbasp firmware wasn't being retarded and offered spi data passthrough I would pretty much only use it, though
06:31 PM Lambda_Aurigae: just barely fits in the boot section of an atmega1284p
06:31 PM Emil: what?
06:31 PM Lambda_Aurigae: an ethernet bootloader
06:32 PM Emil: nice
06:32 PM Lambda_Aurigae: based on the tuxgraphics lib
06:32 PM Lambda_Aurigae: using an enc28j60 spi-ethernet chip.
06:32 PM gamelaster: whoah
06:33 PM gamelaster: that's great
06:33 PM Lambda_Aurigae: it's functional.
06:33 PM Lambda_Aurigae: needs work.
07:29 PM enhering: Need help with something
07:30 PM Lambda_Aurigae: don't we all...
07:30 PM enhering: https://usercontent.irccloud-cdn.com/file/10c2aJbw/Screen%20Shot%202017-03-11%20at%2021.47.25.png
07:31 PM Emil: what's the question
07:31 PM enhering: This is the way I transfer data between two AVRs using SPI
07:31 PM enhering: Master asks, slave answers.
07:32 PM enhering: Answer can be any size from zero to 255 bytes
07:32 PM Lambda_Aurigae: 0x02 0xA3 0x5C 0x11
07:32 PM Lambda_Aurigae: there's your answer then
07:33 PM enhering: https://gist.github.com/enhering/8b8bf5a094f1d3d1ecb840c03827e085
07:33 PM enhering: This is the code
07:34 PM enhering: I need to change that protocol to implement a "Master send data to slave"
07:34 PM enhering: Any suggestions on where to change the protocol?
07:35 PM Lambda_Aurigae: read the datasheet
07:35 PM Lambda_Aurigae: it tells how to handle master and slave communications on the chip.
07:35 PM enhering: Only one byte at a time
07:35 PM enhering: I'm transferring long numbers
07:36 PM enhering: And not all answers are of the same size
07:36 PM Lambda_Aurigae: yeah, let me read your 421 lines of code and figure it out for you.
07:36 PM enhering: Don't want that
07:36 PM enhering: Did you get the picture?
07:36 PM Lambda_Aurigae: saw it.
07:36 PM Lambda_Aurigae: looks twisted and useless to me.
07:36 PM enhering: Maybe you can see a way on the picture
07:37 PM enhering: I'd like just a suggestion, if possible.
07:37 PM enhering: I've never seen anything like that implemented
07:37 PM enhering: Have no idea how they do it on sensors that talk via SPI
07:38 PM enhering: Ok, Lambda_Aurigae. Sorry then.
07:38 PM Emil: enhering: implement framing if you don't trust your coding
07:38 PM Emil: also implement framing if you are a real programmer
07:38 PM Lambda_Aurigae: I would have to read through your code and study the picture and compare the two.
07:38 PM Lambda_Aurigae: and it's 7pm and I'm watching Dr Who..
07:38 PM enhering: Maybe I'm not a real programmer. I do not even know what framing is
07:39 PM Lambda_Aurigae: google is your friend.
07:39 PM enhering: Forget it, Lambda_Aurigae . Go watch Doctor Who.
07:39 PM enhering: This is open code. May be useful for you too.
07:41 PM enhering: This twisted, useless, thing can transfer many bytes between slave and master, when asked by master
07:41 PM enhering: I bet you will need this one day
07:42 PM Emil: enhering: mate
07:42 PM Emil: that's not helping
07:42 PM Emil: enhering: if you can already send bytes between the two then it should be trivial to expand it
07:42 PM enhering: I thought that too. It is not.
07:42 PM Emil: it is
07:42 PM Emil: Here's framing
07:42 PM Emil: https://en.wikipedia.org/wiki/Frame_synchronization
07:43 PM Emil: And then you can restrict your symbol space / reserver some symbols strictly for one thing
07:43 PM Emil: Your bus is byte oriented but you are pretty much guaranteed that you don't get out of sync packets
07:45 PM enhering: Thanks, Emil . If I understood well, If I use some bits for framing, that will reduce the number of questions I can ask to the slave by a factor 4.
07:48 PM Emil: enhering: You could just implement variable length symbols and reserver some symbols for specific things
07:48 PM Emil: for example
07:48 PM Emil: you start a connection with sending 255 and the slave must answer with 0 and then you send a 0 and the slave must answer with 255
07:49 PM Emil: that makes sure the slave/master conn is actually working
07:49 PM Emil: Then you can exchange bytes as you desire
07:49 PM enhering: Ok. I do something similar
07:49 PM Emil: and if you want to send 0 or 255 as actual data payload have some other symbol like 1 after which the next byte is the real data byte
07:49 PM Emil: or whatever
07:50 PM Emil: you literally can do anything you want ;)
07:50 PM enhering: This is the part that I can do now.
07:50 PM enhering: I can send a number to the slave
07:51 PM enhering: It sends me back the size of the data related to that number, and the data
07:51 PM enhering: with some signaling as you suggested
07:52 PM enhering: Problem is changing this signaling to say that I want to send data to a slave, instead of reading from it.
07:53 PM enhering: I'm trying to find the best way to change the protocol.
07:53 PM Emil: That's on you
07:53 PM Emil: we aren't here to code it for you, especially if you go about it like you have here ;)
07:53 PM enhering: Sorry for asking, Emil.
07:53 PM Emil: -.-
07:53 PM enhering: I did not want to disturb.
07:53 PM Emil: enhering: you know exactly what you did wrong, mate
07:54 PM Emil: using that kind of tone does not help your cause
07:54 PM Emil: notice how I am still helping
07:54 PM enhering: Ok. Sorry, then.
07:54 PM Emil: that can quickly change if you don't quit the snarky attitude ;)
07:54 PM enhering: Did not notice I was being rude. Sorry again.
07:55 PM enhering: Lambda_Aurigae was so gentle to me. I should never had disturbed him.
07:56 PM Lambda_Aurigae: me, gentle?
07:56 PM Lambda_Aurigae: I'm a bastard.
07:57 PM enhering: I'll bring you a bunch of hay next time i have a question.
08:01 PM Emil: enhering: if you can code in C and can send a byte from a slave to a master and read the response
08:01 PM Emil: then you can implement framing and a protocol
08:02 PM Emil: enhering: but that's on you, the writing part
08:02 PM Emil: you can ask for ideas and help, though, obviously
08:02 PM enhering: I'm asking for ideas, not code, Emil
08:02 PM Emil: enhering: okay shoot
08:03 PM Rez is now known as LoRez
08:03 PM enhering: If I use some bits for framing I reduce a lot the number of ques
08:03 PM enhering: tons I can ask
08:03 PM Emil: if you want to have a constant reserved bitfield then that's what you do, sure
08:03 PM enhering: a question is a byte I send to the slave that identifies what data I want it to send back to me
08:04 PM Emil: if you want to reserver 4 bits for some control data you can send data out as hex
08:04 PM Emil: but notice how above I din't recommend having constant bitfields
08:04 PM enhering: Now I do not reserve a bitfield.
08:04 PM enhering: I do more or less what you suggested
08:05 PM Emil: okay
08:05 PM Emil: and the idea/question was?
08:05 PM Lambda_Aurigae: so send two bytes
08:05 PM enhering: master sends a zero, slave answers with a zero, than master sends a question, slave answers with size, master sends 1, slave start sending bytes back
08:06 PM Lambda_Aurigae: then you get 65535 commands.
08:06 PM enhering: SPI is 8 bits, not 16
08:06 PM Lambda_Aurigae: two
08:06 PM Lambda_Aurigae: transmissions
08:06 PM Lambda_Aurigae: two bytes
08:06 PM Lambda_Aurigae: 16 bits
08:06 PM Emil: Lambda_Aurigae: well, basically the first byte is lost really, and should just be used for keepalive
08:06 PM enhering: no need for so many questions
08:06 PM Lambda_Aurigae: or
08:07 PM Lambda_Aurigae: slave sends first byte as the number of bytes of data remaining in the queue....master then requests that many more bytes of data.
08:07 PM Lambda_Aurigae: one at a time.
08:07 PM Emil: (that is trusting the communication channel)
08:07 PM Emil: (which is reasonable)
08:08 PM Emil: Though I personally use stronger framing
08:08 PM enhering: Lambda_Aurigae: I need to have a connection reset. When master sends a zero, slave resets the connection
08:08 PM Emil: That is not timeout based
08:08 PM Emil: enhering: then code one :D
08:08 PM Lambda_Aurigae: there are a dozen ways to do it.
08:08 PM enhering: If something goes wrong, master sends a zero to the slave and it all restarts
08:08 PM Lambda_Aurigae: you just have to figure out what works for your particular project.
08:09 PM enhering: this thing works already
08:09 PM Emil: enhering: what is the question then :D
08:09 PM Emil: Lambda_Aurigae: do you have pointers on tag based search?
08:09 PM Lambda_Aurigae: ummm...no.
08:10 PM enhering: how to make the master signal to the slave that master wants to send data, instead of read data
08:10 PM Emil: use a different symbol
08:10 PM Emil: what did you expect?
08:10 PM Emil: you have 256 symbols at your disposal
08:11 PM enhering: So, somewhere the master should say: hey, slave, now I want to write. So prepare to receive the following bytes as data for register xxx
08:11 PM Emil: enhering: yes, and you knew that
08:12 PM enhering: I just do not know when is the best moment to do it. I thought maybe you would have a suggestion, as you have way more experience than me
08:12 PM enhering: I took so long to make this simple protocol work.
08:12 PM enhering: reliably
08:13 PM enhering: Sorry, Emil . I do not have 256 symbols at my disposal. The signaling cannot be confused with data
08:15 PM enhering: https://usercontent.irccloud-cdn.com/file/xfggxgeN/Screen%20Shot%202017-03-11%20at%2022.45.16.png
08:15 PM enhering: I tried to make a digram of how the protocol works now. On the left I have the master states, on the left, the slave states
08:16 PM enhering: https://usercontent.irccloud-cdn.com/file/6RRQVpXv/Screen%20Shot%202017-03-11%20at%2022.46.50.png
08:16 PM enhering: Sorry. This is the right one
08:17 PM enhering: The arrows in the middle show each SPI transfer
08:17 PM Emil: sigh
08:17 PM enhering: Horrible, I know. I do not know a better way of displaying this
08:18 PM enhering: Sorry. I know this is confusing.
08:19 PM enhering: Forget all of it. I'll go back to coding.
11:35 PM homa_: hi
11:36 PM homa_: what is it the best simulator of avr for linux
11:43 PM homa_: are there every body here ?
11:44 PM homa_: Casper:
11:44 PM xentrac: I've successfully gotten simavr to run its examples and view the results in gtkwave
11:45 PM Casper: you probably don't want simulators... they are too limited, better run the code on a real device
11:45 PM homa_: Casper: my vid and pid of programmer is not valid
11:46 PM homa_: usbasp
11:47 PM homa_: and avrdude said me : update firmware
11:47 PM xentrac: Casper: that's interesting — you don't think simulators are useful for anything?
11:47 PM homa_: for new users
11:47 PM Casper: homa_: contact the seller, see what he have to say about it. If online, you may want to open a dispute until it get figured out
11:48 PM Casper: xentrac: maybe, but here's the thing: you can't interface your stuff with it, timing is all screwed up for the external devices, some simulator don't even respect the latency of the avr own's functions...
11:49 PM Casper: how can you test your stuff when even a simple hd44780 is problematic?
11:49 PM rue_shop3: red led
11:49 PM homa_: Casper: are there any catalog for programmer ?
11:49 PM Casper: sure there is some official ones
11:50 PM daey_ is now known as daey
11:50 PM homa_: and have information about pid and vid of device ? Casper
11:50 PM Casper: that should be irrevelant
11:50 PM Casper: if avrdude do not support it, then your device is most likelly useless
11:50 PM Casper: and not a proper one
11:52 PM * Casper gots tom's programmer