#avr | Logs for 2016-02-02

Back
[00:48:31] <Shavik> Wow. So apparently you can't set SPCR inside a function. It just doesn't work.
[00:49:46] <Shavik> SPCR = ((1 << SPE) | (1 << MSTR) | (0 << SPR0) | (0 << CPOL) | (0 << CPHA) | (0 << DORD)); Inside an "init" function in a library in Atmel studio but my SCK stayed active low, and everything was LSB.
[00:50:07] <Shavik> Moved that line to my main .cpp and it works. only thing I changed. verified with MSO oscope
[00:53:04] <cehteh> possibly some other error... are you sure the function and the line containing that assignment are called?
[00:56:04] <julius> morning
[00:56:05] <Shavik> Yea, its the only place that SPI could have been enabled
[00:56:39] <Shavik> And it was enabled for sure, just clock idle high. I didn't verify the CPHA operation
[00:56:56] <julius> anybody who got to much time on his hands: http://fab.cba.mit.edu/classes/863.14/people/andrew_mao/week11/ built a opto isolated usb hub https://www.maximintegrated.com/en/app-notes/index.mvp/id/3891
[00:56:56] <cehteh> even spi examples in the datasheet using some function .. and setting that from a function should not change any semantics and just work
[00:57:00] <Shavik> But the endian-ness and clock idle state's bit were "not taking effect"
[00:57:14] <cehteh> i am sure you doing something else wrong
[00:57:19] <Shavik> Yea, I guess the only difference is the function I was calling was in a "library" in atmel studio
[00:57:28] <Shavik> So a separate project
[00:57:33] <Shavik> But same solution
[00:57:37] <Shavik> never had this problem before though
[00:57:46] <Shavik> Spent all afternoon on it :(
[00:58:48] <cehteh> some stupid bug :)
[00:58:49] <Shavik> It's "fixed" now, Guess that's all that matters. moving on to the next issue lol
[00:58:57] <cehteh> using = instead |= or so
[00:59:04] <Shavik> I tried both ways
[00:59:14] <Shavik> Even setting it to a number
[00:59:17] <Shavik> like constant
[00:59:34] <Shavik> SPCR = 0x53; // just made up 53 but you get the idea
[01:00:25] <Shavik> This is what I get for trying to be clever and hide away stuff in functions lol
[01:01:04] <cehteh> huh
[01:01:13] <cehteh> that cant be it
[01:01:48] <cehteh> julius: where is the opto isolator?
[01:03:05] <Shavik> cehteh: https://gyazo.com/08d0910032dce3ca726833f66b6ff9db Some code for ya
[01:04:51] <cehteh> what calls setup() what calls InitSPI()
[01:05:10] <cehteh> and dont paste code as screenshots :D
[01:05:50] <Shavik> :) InitSPI was just called in s etup on the left but didn't work
[01:05:56] <Shavik> setup is just called first in main
[01:05:57] <Shavik> very basic
[01:06:09] <Shavik> So i moved the body of InitSPI to setup and it works fine
[01:06:12] <Shavik> thats all I did
[01:06:17] <cehteh> still i am sure you have some bug somewhere
[01:07:20] <cehteh> btw why do you shift zeros?
[01:56:14] <Alex1992> Hi, I'm having some trouble bootloading an atmega32 with my sparkfun avr programmer, and I was hoping I could get your guy's input on what I can change. I'm pretty new to microcontroller, so it's very likely I'm making a dumb mistake.
[01:56:47] <Alex1992> I have built two boards, one for a 4x4x4 cube (which I have totally working) and another board for a 8x8x8 (which is giving me trouble)
[01:57:40] <Alex1992> for the 4x4x4, I bootloaded a sequence and set some fuses on an atmega32. I then removed the atmega32 from the 4x4x4 and placed it onto the 8x8x8
[01:58:06] <Alex1992> I'm hoping to bootload off the 8x8x8 board, but I can't get the avr programmer to talk to the chip now
[01:59:07] <Alex1992> I get errors like "expected 4, got -5" if I run "avrdude -c usbtiny -p m32 -B 50"
[01:59:42] <Alex1992> additionally a "Device signature = 0x0000000"
[02:00:08] <Alex1992> I've been checking all my wiring but havent found an error yet. Any ideas?
[02:05:09] <Casper> you said you changed the fuses
[02:05:18] <Casper> did you touched the clock source fuses?
[02:05:46] <Alex1992> casper: yeah i changed to an external oscillator. Both boards use an external
[02:06:06] <Casper> external oscillator != external crystal
[02:06:31] <Alex1992> oh ok, it's a crystal then
[02:08:32] <Casper> if you set the fuses to external clock but used a crystal, then you semi-bricked the chip
[02:09:28] <Casper> external oscillator/clock mean that you have a device that you basically feed power and ground, and it output a clock signal. It have the full circuitry needed to self oscillate
[02:10:17] <Casper> external crystal is like a bell, the avr send a pulse of power, and the crystal resonate. The avr constantly send some pulses so it always oscillate
[02:10:34] <Casper> in external clock, it do not send those pulses
[02:11:09] <Alex1992> I guess I'm confused. I have a 14.7456MHz crystal with some small capacitors attached to xtal1 and 2. This configuration worked for the 4x4x4 cube
[02:11:39] <Alex1992> it doesn't work on the 8x8x8 cube board though, even though it's all the same elements
[02:11:45] <Casper> yes. that's an external crystal
[02:12:04] <Casper> but does your fuses match it?
[02:12:28] <Alex1992> how do you mean? I'm not really sure what's happening inside the avr when I'm changing fuses
[02:12:41] <Alex1992> If you mean is it the same pinout, then yes
[02:13:17] <Casper> ok, the fuses give some parameters to the avr on what to do
[02:13:29] <Casper> one set of fuses is for where the clock signal come from
[02:13:38] <Casper> you said you changed the fuses
[02:13:50] <Casper> which mean you possibly set the wrong clock source
[02:14:24] <Alex1992> So I changed the fuses like a week ago to get the 4x4x4 cube working
[02:14:28] <Alex1992> I haven't touched them since
[02:15:02] <Casper> ok then it is not the issue..
[02:15:58] <Alex1992> Ok, cool. One possibility ruled out. My biggest worry is that I bricked this chip somehow by mounting inside a new board
[02:16:18] <Casper> have you tried to put it back to the old one?
[02:17:01] <Alex1992> haha, that's a really good point and something I was trying to avoid, since removed this 40 pin chip from the socket is a huge pain in the ass
[02:18:09] <Alex1992> Is there any inherent risk though in switching microcontroller in and out?
[02:18:36] <Casper> btw, a signature of 0x000000 mean that the device did not replied
[02:18:47] <Casper> the main risk is to break pins
[02:19:02] <Casper> second risk is to insert it in reverse
[02:19:39] <Alex1992> but not like running old code on a new board, and screwing up other elements?
[02:20:04] <Alex1992> and yeah, the 0x0000000 message is something I'm trying to understand
[02:20:16] <Alex1992> -p m32 should be the code to communicate
[02:20:39] <Alex1992> could this be a wiring thing with the MOSI, MISO, ... stuff?
[02:20:46] <Casper> could be
[02:21:33] <Alex1992> ok, i'll check again. do you know what the expected 4, got -5 thing is all about?
[02:21:39] <Casper> Master Out Slave In Master In Slave Out Serial CloCK REseT
[02:21:42] <Alex1992> is that a checksum?
[02:21:46] <Casper> no idea
[02:24:30] <Casper> bed time, nite
[02:25:09] <Alex1992> ok, thanks for the help casper. night
[03:14:21] <julius> cehteh, the max ic document got a scematic with the optocoplers
[03:14:45] <julius> cehteh, the idea is to now switch d+ / d- from usb directly but the spi, which can run slower
[07:20:40] <sdistefano> hey! I'm trying to use an arduino to write to a m168 chip, but I can't get it to read the chip at all
[07:20:50] <sdistefano> I rechecked the connections on the breadboard a million times
[08:28:57] <jben> sdistefano: I don't use arduino, but I hear there is a bootloader on the AVR. I don't know if it's necessary to read the chip.
[08:31:04] <sdistefano> Solved, it was necessary to burn an example called arduinoISP first in order to use it as an ISP
[08:33:28] <jben> sdistefano: oh, i had understand you want to program the chip of the arduino board, not another
[08:34:10] <sdistefano> another chip through the arduino, sorry if I was unclear
[08:35:01] <jben> you was not
[08:36:50] <jben> I am not a user of arduino, so my understanding have a bias
[08:37:21] <jben> I was a user of mega, but since I switch to xmega, I don't want to use mega anymore
[10:21:42] <chickensk> hi, anybody knows a good book about digital controllers for audio?
[10:50:53] <Lambda_Aurigae> chickensk, that's kind of a broad subject.
[10:50:58] <Lambda_Aurigae> can you narrow it down some?
[10:51:34] <chickensk> well i am interested in anything about this subject
[10:51:56] <chickensk> lets take faders
[10:52:32] <chickensk> you can not have more than 16 of those, because its on midi pitchbend
[10:52:35] <Lambda_Aurigae> so, you are wanting to do audio DSP?
[10:52:50] <chickensk> controllers, i am not interested in dsp
[10:53:15] <chickensk> of course i use dsp for audio, but not interested in developing those
[10:55:16] <LeoNerd> I'm still totally unsure what the question is
[11:00:36] <chickensk> if there are any books, articles, or other good quality sources on how and why these controlers work / are developed etc/
[11:01:20] <LeoNerd> "these controllers" ?
[11:01:24] <LeoNerd> I'm not sure what things you are referring to
[11:01:34] <LeoNerd> Can you draw a picture, or post an amazon link, or.. something? anything?
[11:03:11] <stanreg> Can V-USB or LUFA, on an AVR, be used to monitor/log a USB 1.1 connection packets?
[11:03:31] <Lambda_Aurigae> stanreg, not directly...usb is a very touchy protocol.
[11:03:53] <LeoNerd> Get yourself a saleae (or clone) for that kind of observation
[11:04:03] <Lambda_Aurigae> lufa relies on the avr having usb hardware built in...that hardware MIGHT be able to do it if someone wanted to write the software forit.
[11:04:36] <Lambda_Aurigae> v-usb,,,,I doubt it would be able to do it.....would be easier just to write something to capture packets raw than to try to use v-usb for anything like that.
[11:04:52] <Lambda_Aurigae> http://www.sweetwater.com/store/detail/XTouchC?adpos=1o1&creative=55226083081&device=c&matchtype=&network=g&gclid=CNu29YjC2coCFcKGaQod1FIGvg
[11:05:07] <Lambda_Aurigae> LeoNerd, I'm guessing something like this is being referenced by "these controllers" but not sure.
[11:05:15] <stanreg> LeoNerd, I do have one at hand. Still would like to use AVR.
[11:05:46] <LeoNerd> Lambda_Aurigae: Oh.. those things. Those are nothing audio-related at all
[11:05:51] <LeoNerd> It's just a MIDI controller
[11:05:56] <stanreg> Lambda_Aurigae, understood. Thanks for the explanation.
[11:06:06] <Lambda_Aurigae> stanreg, if you read the usb protocol and study how usb devices communicate it would help.
[11:06:19] <stanreg> Lambda_Aurigae, done :)
[11:06:58] <Lambda_Aurigae> v-usb and lufa implement the whole packet protocols...a simple logic analyzer or bit capture device would be better at monitoring the comms.
[11:07:18] <Lambda_Aurigae> also, note that changing the impedence/resistance on usb lines will cause you some comms headaches.
[11:08:08] <LeoNerd> Well, more from capacitance
[11:08:14] <Lambda_Aurigae> that too.
[11:08:18] <stanreg> Lambda_Aurigae, if my avr clamps on existing d+ and d- lines, in parallel, I'll have impedence/resistance issues?
[11:08:51] <Lambda_Aurigae> so, any device connecting to the usb lines to monitor need to be very circumspect, not changing the lines much.
[11:09:44] <stanreg> agreed.
[11:11:16] <LeoNerd> Logic probes are usually fairly good at being quite passive
[11:18:43] <Guest75495> Hi there. pls, I have a question about avr attiny USB programmer. I have bought this one: http://www.ebay.com/itm/1pcs-Development-Programmer-Board-for-ATtiny85-ATtiny13A-ATtiny25-OZ-/131688002222?hash=item1ea93772ae and my question is, if is it possible to programm chip from linux?
[11:20:34] <LeoNerd> Er.. WTF even is that?
[11:53:00] <Lambda_Aurigae> it looks like a board requiring the chip be pre-programmed with v-usb bootloader
[11:53:58] <LeoNerd> Eh.. personally I wouldn't bother
[11:54:06] <LeoNerd> Just stick a regular ISP6 header on the board and talk normal ISP to it
[11:54:28] <Lambda_Aurigae> I see no other chip on board to handle the usb...looks like a v-usb implementation.
[11:54:36] <Lambda_Aurigae> which requires the chip be pre-programmed.
[11:54:50] <Lambda_Aurigae> cheap
[11:54:52] <Lambda_Aurigae> and useless
[11:54:59] <Lambda_Aurigae> it's not a programmer.
[11:55:05] <LeoNerd> Yah
[11:55:21] <Lambda_Aurigae> it can be used to program other chips if your attiny85 is programmed with the usbasp software.
[11:56:27] <Lambda_Aurigae> guessing mister Guest left?
[11:56:42] <LeoNerd> Seems so
[11:57:51] <Lambda_Aurigae> I have joins/parts turned off because they became horribly annoying.
[12:05:52] <LeoNerd> I'm pondering making some kind of "mixed analog/digital bridge helper board"... devboard.. thiny. I don't really have a good name for it
[12:06:40] <LeoNerd> But the idea would be a big SPI port + lots of SS lines on the digital side, and lots of analog pins. Inbetween is a multichannel ADC (a good one.. 16, if not 24-bit), a multichannel DAC, several analog switches of various kinds, possibly a digital pot or two, some anacomps perhaps...
[12:06:44] <Lambda_Aurigae> ADC/DAC thingie
[12:07:20] <LeoNerd> All the analog switches would just be strung off a shift-register chain so that's easy. Or maybe a GPIO expander so Ican share that for input from the anacomps
[12:07:46] <LeoNerd> But very important that all the digital IO is the SPI bus plus some SS lines, and maybe an IRQ or two for ADC / anacomps
[21:10:22] <flyback> is intrgrated heater tips work it?
[21:50:42] <t4nk392> hi. please, have anybody Lcsoft Studio USBASP v2.0 programmer?
[21:51:00] <rue_house> I have a usbasp
[21:51:05] <rue_house> what do you want to know?
[21:51:42] <rue_house> did you write a lot of code, expecting that it would all just work when you ran it, and it dosn't, and your trying to use a debugger to pick thru all the problems?
[21:53:01] <t4nk392> i need original firmware. pls, may i ask you for it?
[21:54:06] <t4nk392> i flashed http://www.fischl.de/usbasp/ firmware, but now windows and linux cannot recognize it
[22:01:55] <cehteh> that site is as orignal as you can get it .. lcsoft stuff would be a clone
[22:02:08] <cehteh> did something with the fuses?
[22:02:17] <cehteh> or other pinout?
[22:10:05] <t4nk392> i dont know.. but i flashed attiny85 via usbasp, and there was a message: avrdude: warning: cannot set sck period. please check for usbasp firmware update.
[22:11:00] <t4nk392> after that i flashed new firmware to usbasp.. now, i cant flash anything to the attiny85 with usbasp
[22:15:26] <cehteh> maybe your usbasp is slightly different, other crystal, using other io pins
[22:16:16] <t4nk392> yes, maybe :) ..so i need original firmware, but i cant find it on the internet
[22:16:20] <cehteh> you did not forget to pull the self programming jumper?
[22:17:06] <cehteh> the fishl pages has a schematic .. just measure if thats the same with your hardware
[22:17:21] <cehteh> if not get the source, adapt it
[22:18:12] <t4nk392> i did not forget it. flashing was successful
[22:18:16] <t4nk392> avrdude: 4898 bytes of flash verified
[22:19:33] <cehteh> pul .. after you finished
[22:19:58] <cehteh> anyway .. maybe just a little different io assignment, you can figure that out
[22:24:47] <t4nk392> maybe :) but i followed this manual http://www.rogerclark.net/updating-firmware-on-usbasp-bought-from-ebay/ , but whithout backup
[22:24:50] <cehteh> protip: next time make a backup before flashing new firmware :D
[22:25:01] <t4nk392> yes :)
[22:58:47] <t4nk392> thank you for your help. have a nic day :)