#avr Logs

May 20 2017

#avr Calendar

12:00 AM LoRez: This dragon is annoying me.
12:07 AM LoRez: do mega2560's (arduinos) come jtag-locked?
12:10 AM Tom_L: i can't remember sry
12:13 AM day__ is now known as day
12:26 AM LoRez: so, hfuse was 0xD8. Turned it to 0x18 to turn on OCD and JTAG.
12:26 AM LoRez: still can't get this dragon to talk to it
01:24 AM anonnumberanon: what is dragon.link pls?
02:03 AM Casper: LoRez: considering that jtag usually take 4 pins out of the ADC port, and the arduino have the 8 ADC channels available, I'ld say that they did indeed disabled jtag
05:07 AM day__ is now known as day
05:57 AM polprog: https://hastebin.com/alokoyomal.vbs
05:57 AM polprog: are there any rookie mistakes here?
06:08 AM polprog: except for syntax, now it compiles, duh
06:21 AM Tachyon` is now known as Tachaway
06:42 AM polprog: disassembled looks like it should work
06:47 AM antto: moar NOPs!
06:49 AM Jartza: polprog: at least you're not using call-saved registers, which is good
06:49 AM Jartza: for 595 timing, nop is not usually good idea as you don't know how fast MCU is being run :)
06:52 AM Jartza: but using "sreg" as name is confusing
06:52 AM Jartza: because AVR has it's own SREG, status register
07:08 AM polprog: Jartza: i read the note before :P i checked which registers i can use
07:08 AM polprog: i'll have to change that "sreg", it may be confusing
07:09 AM polprog: as for the timing, that nop is there in case some stray capacitance is there? i'm not sure but the 595 datasheet says that the clock can be up to 35MHz, so faster than any avr out there
07:10 AM antto: polprog there are a few different flavours of 595, thus different datasheets
07:10 AM polprog: yeah, that's a second reason for the nop
07:11 AM antto: but yeah, they *should* be capable of running quite fast
07:11 AM Emil: polprog: what is that .vbs extensiob?
07:11 AM polprog: if i had something that could run up to 100MHz, i'd check how fast can they really go
07:11 AM polprog: like some FPGA of some sort
07:11 AM polprog: but that's distant future
07:11 AM antto: in my C++ implementation of a shiftreg driver, i use a macro for the delay between clocks, which can be overriden with a -Ddefine
07:12 AM Emil: polprog: stray capaxitance is rarely an issue like that
07:13 AM Emil: you can just remove nops if they are to "account" for it
07:13 AM polprog: the nops are not just for stray capacitance
07:14 AM polprog: i think ill leave them, it's just for controlling a single 7-seg
07:14 AM polprog: doesnt have to be superfast
07:14 AM polprog: erm
07:14 AM antto: i'd leave them.. i'd even put moar
07:14 AM polprog: i will leave them ;)
07:15 AM Emil: polprog: wtf niga
07:15 AM Emil: remove them :D
07:16 AM polprog: i havent flashed that yet
07:16 AM Emil: polprog: remove nops
07:16 AM Emil: polprog: dont be silly
07:16 AM polprog: let me test that first
07:17 AM polprog: gtg
07:17 AM polprog: dinner :D
07:17 AM Emil: dinner?
07:17 AM Emil: At 15 which for you is what 14?
07:17 AM Emil: wtf :D
07:19 AM antto: dinner is when yo hungry so much that no snack's gonna b enuf
07:21 AM polprog: well
07:21 AM polprog: i dont see a problem with soup at 2 o'clock
07:24 AM Jartza: polprog: not sure if potato chip has 595 yet, but they have made a lot of 74xxx chips that are capable of speeds up to gigahertz
07:25 AM polprog: "potato semiconductor corporation"
07:25 AM polprog: wot
07:26 AM polprog: also, my workbench is not capable of GHz speeds
07:26 AM polprog: :D
07:27 AM Jartza: yes :D
07:27 AM Jartza: potato is the best name for company manufacturing chips .D
07:28 AM Jartza: potato chips. lol
07:28 AM antto: potato semi huehue
07:28 AM polprog: we had CEMI in poland, CEMI semi
07:30 AM polprog: nice chips
07:31 AM antto: the potatosemi website looks too chinese in a bad way
07:31 AM polprog: it looks bad
07:31 AM antto: but who cares, if their stuff works..
07:31 AM polprog: huh, CEMI even managed to make a clone of 8080
07:31 AM antto: wut dat?
07:34 AM polprog: for this i think: https://www.youtube.com/watch?v=3d6nhvsSb30
07:35 AM polprog: just another vintage computer
07:40 AM Emil: polprog: I think you meant lunch
07:40 AM polprog: probably
07:41 AM Emil: though us northeners do like to eat dinner at 16~17
07:42 AM polprog: i could flash that code to the "evaluation board", but that would probably get me and i'd sit there for the next 3 hours
07:42 AM polprog: hmm
07:53 AM polprog: doesnt work
07:53 AM polprog: well, time to troubleshoot
07:53 AM polprog: grr
08:01 AM polprog: that was easy
08:01 AM polprog: wow
08:01 AM polprog: i did it
08:52 AM day__ is now known as day
09:51 AM polprog: http://gfycat.com/VibrantShortBlackfly
09:52 AM polprog: 20 minutes of assembly and C :)
09:53 AM Emil: Not too bad!
09:53 AM Emil: What are you doing for timing?
09:53 AM Emil: just busylooping=?
09:54 AM polprog: the 595 handler is pure assembly, the main loop with bit shift is in C
09:54 AM polprog: i couldnt be bothered to calculate the delay loop so i just used _delay_ms()
09:54 AM polprog: i guess i could write all of it in asm
10:03 AM Tom_L: you should
10:03 AM Tom_L: it's good for the soul
10:05 AM polprog: i like the idea of writing high level stuff in C and low level in assembly
10:05 AM polprog: string operations in asm are still a mystery to me,
10:05 AM polprog: i have a vague idea how i would send a string down a uart,
10:06 AM polprog: i haven't accessed a single memory adress in asm, it's all thanks to 32 registers :P
10:06 AM polprog: let me see the RAM handling stuff
10:08 AM polprog: i guess the adress has to be put in one of the 16 bit reg
10:08 AM polprog: registers*
10:08 AM polprog: and then use LDS/STS
10:15 AM Lambda_Aurigae: you do it the same way in C as you do in ASM
10:15 AM Lambda_Aurigae: one byte at a time.
10:15 AM Lambda_Aurigae: you just handle the string as an array of bytes.
10:15 AM Lambda_Aurigae: null terminated generally.
10:16 AM Lambda_Aurigae: I've done strings two ways...first was standard null termination...second was a pair of bytes at the beginning telling max length and actual length.
10:55 AM Tachyon` is now known as Tachbusy
11:00 AM JanC_ is now known as JanC
12:05 PM LoRez: Casper: that makes sense.
12:05 PM LoRez: setting that flag to 0 should enable it though
12:32 PM Casper: I feels like atmel screwed up royally by putting the jtag on the adc
12:32 PM Casper: but in another way... where else...
12:32 PM Casper: they should atleast have put it on the upper ADC pins...
02:34 PM polprog: you know you can enable/disable jtag via software, so what's the problem?
02:38 PM polprog: Casper:
02:42 PM timemage: LoRez, for what it's worth, i have connected an avr dragon to a arduino mega adk. but it was like two years ago. so i don't remember much of anything from it besides what you already know about changing the fuse.
02:43 PM LoRez: timemage: but it did work?
02:43 PM timemage: LoRez, yes
02:43 PM polprog: connecting the arduino to any programmer should be trivial,
02:43 PM LoRez: polprog: I'm not trying to program it. I'm trying to verify the JTAG is working on the dragon
02:44 PM polprog: ah
02:44 PM polprog: i cant help you then :/ never used JTAG
02:44 PM LoRez: I have another chip I'm trying to JTAG, but not having any luck getting it working on a known unlocked chip
02:44 PM timemage: LoRez, i've also used it with debugwire on a 328p and a few others. but mostly just for isp.
02:46 PM timemage: LoRez, actually i have a foggy memory of needed to do an upgrade to the dragon via atmel studio in order to get avrice working with it. but i don't if that was for debug wire or jtag or what.
02:46 PM polprog: i need to try dW and JTAG for debugging stuff
02:47 PM LoRez: timemage: I did go hunting for updates to the dragon, but without windows it seems I'm SoL.
02:48 PM timemage: polprog, it's often more trouble than it's worth. particularly debugwire. if you do play with debug wire just keep in mind once you turn it on via fuse its on until you turn it off to enable isp. this confuse the crap out of people and they think they've semi-bricked their chips.
02:49 PM LoRez: lol
02:49 PM LoRez: I turned debugwire off. avarice fired right up.
02:49 PM LoRez: grrr
02:49 PM LoRez: that's what I get for copy-pasta
02:50 PM polprog: timemage: thanks for the heads up
02:50 PM polprog: :)
02:50 PM timemage: LoRez, lol,
02:50 PM polprog: guess i will write my own "debug uart" in assembly.
02:50 PM LoRez: Failed to read target memory space: JTAG ICE timeout exception
02:50 PM LoRez: terminate called after throwing an instance of 'jtag_exception'
02:50 PM timemage: LoRez, you had both on i take it?
02:51 PM polprog: flushng the whole register file down UART
02:52 PM LoRez: avarice --part atmega2560 -B 4 --debugwire --dragon :4242 # was what was recommended
02:52 PM timemage: LoRez, i dunno why that would be. i'm not even sure that chip does debugwire. most of the larger ones don't.
02:52 PM LoRez: anyway... I guess I'm going out into the big-blue-room for a while.
02:53 PM LoRez: I'll futz with it later. Thanks for rubber-ducking for me
02:53 PM timemage: LoRez, so.. to be clear you've traded one problem for another right?
02:54 PM Lambda_Aurigae: LoRez, watch out for that nuclear fireball! It's a killer!
06:32 PM Tachbusy is now known as Tachaway
07:30 PM day__ is now known as day
08:57 PM LoRez: timemage: seems so
09:15 PM day__ is now known as day
11:31 PM Emil: Wait
11:32 PM Emil: Did avrd have single instruction or?
11:33 PM Emil: x|=1|6; takes a single instruction?
11:34 PM Emil: 1|8*
11:43 PM Emil: Yes
11:43 PM Emil: But for io register?
11:44 PM Emil: gah
11:45 PM Emil: so for 3 or greater
11:45 PM Emil: bits
11:45 PM Emil: you should do in, or/ori, out
11:45 PM Emil: since sbi is single bit
11:46 PM Emil: does gcc do it like first to guarantee immediate operation hmm
11:46 PM Emil: or does it actually sbi, sbi if 2 bits
11:47 PM timemage: Emil, there is an OR instruction.
11:48 PM Emil: timemage: read thw ramble to the end ;)
11:48 PM timemage: Emil, i can't make complete sense out of it.
11:49 PM Emil: PORTB|=3; is in, ori, out
11:49 PM Emil: or if the compiler does not care about timinh
11:50 PM Emil: sbi, sbi
11:50 PM timemage: Emil, and you what me to say what about that?
11:50 PM Emil: I was under the impression that one could single cycle or io T.T
11:53 PM timemage: Emil, dunno where that idea comes from.