#avr Logs

Jul 27 2017

#avr Calendar

12:16 AM rue_more: I wonder if its derates for 120
01:00 AM Thrashbarg_ is now known as Thrashbarg
02:14 AM JanC_ is now known as JanC
02:37 AM ferdna: can anyone tell me why i am getting this message when connecting my stm32 board
02:37 AM ferdna: https://pastebin.com/zB90MNfZ
02:49 AM _ami_: ferdna, which stm32 board?
02:49 AM _ami_: blue pill?
02:49 AM _ami_: or black ?
02:49 AM ferdna: _ami_, it is a cc3d board
02:49 AM ferdna: http://www.oomodel.com/images/fpv/fpvtools/CC3D%20control%20board-3.jpg
02:49 AM ferdna: that one
02:51 AM _ami_: ferdna, how are you connecting it? does it have usb?
02:51 AM ferdna: yes
02:51 AM ferdna: using usb
02:54 AM _ami_: ferdna, are you connecting via usb hub?
02:54 AM ferdna: _ami_, no directly to pc
02:54 AM _ami_: it seems that some issue with the usb firmware or wrong pull ups at D+/D- lines
02:55 AM ferdna: _ami_, hmm i believe usb firmware
02:55 AM ferdna: can i reflash the usb firmware again?
02:56 AM _ami_: i don't know. i have not used this board before. i got blue/black pill boards
02:57 AM ferdna: _ami_, i see
02:57 AM ferdna: _ami_, one more question...
02:58 AM ferdna: _ami_, on this schematic(conn11): http://www.oomodel.com/images/fpv/fpvtools/CC3D%20control%20board-7.jpg
02:59 AM ferdna: specifically "nrst"...
02:59 AM ferdna: to what corresponds on this pinout:
02:59 AM ferdna: http://www.waveshare.com/img/devkit/general/connector-layout-20pin_h220.jpg
04:28 AM pepijndevos: I configured my atmega328 as an SPI slave, but sometimes it just sends 0.
04:29 AM pepijndevos: I put a counter in it instead of the actual data, and the counter is incremented, even though a 0 is sent.
04:30 AM LeoNerd: SPI slaves can be a little picky
04:30 AM Haohmaru: it may not be sending the 0
04:30 AM Haohmaru: do you use a pull-down resistor on the MISO line?
04:30 AM pepijndevos: Inside SPI_STC_vect I'm basically doing SPDR=count++; and then in the logic analyser it goes, 1 2 0 3 etc
04:30 AM Haohmaru: or does the MISO line rest at 0V
04:31 AM LeoNerd: How fast is your master talking
04:31 AM LeoNerd: ?
04:31 AM LeoNerd: I tend to run my SPI bus at (slave fCPU)/16 or so, to give it enough time
04:31 AM Haohmaru: pepijndevos, that means it's not triggering
04:32 AM pepijndevos: Haohmaru, oh my bad, I mean 1 2 0 4, like it is triggering but not sending.
04:32 AM Haohmaru: if your spi master pulls a byte (clocks a byte) but the slave is dead for some reason - you'll see a 0x00 if the MISO line is resting at 0V
04:32 AM Haohmaru: ah, okay, that's different then
04:33 AM Haohmaru: is your spi slave code proper?
04:33 AM Haohmaru: tbh i've never written spi slave implementation
04:33 AM pepijndevos: I have it connected to my ISP, so since the programming works fine, I'm assuming the connection is fine.
04:34 AM pepijndevos: So I'm not exactly sure about pull-down resistors or frequency. Actually, one sec, I can check the frequency from the logic analyser.
04:34 AM Haohmaru: i'd guess in an spi slave, you have to have the TX byte prepared in advance into the spi data register
04:34 AM Haohmaru: because the master can start pulling bits from a new byte at any moment
04:35 AM pepijndevos: 68KHz
04:36 AM pepijndevos: Haohmaru, right, so I write to SPDR inside the interrupt, which should be read on the next transmission.
04:37 AM pepijndevos: LeoNerd, 68KHz
04:37 AM Haohmaru: check if the datasheet says about whether you have to read some error flags before writing to SPDR or so
04:48 AM pepijndevos: Haohmaru, this is essentially what I'm doing http://www.avrfreaks.net/comment/712644#comment-712644
04:50 AM Haohmaru: and the datasheet doesn't say you need anything other than that?
04:51 AM pepijndevos: Not that I can find. You need to enable the interrupt of course.
04:51 AM pepijndevos: I did find that there is a write collision flag.
04:53 AM Haohmaru: well, what happens if you get a command byte from the master, then you put your byte into SPDR which will be shifted out next time - but the CS goes up suddenly
04:53 AM Haohmaru: and the next byte is a command
04:53 AM Haohmaru: there has to be more than just that simple code
04:54 AM pepijndevos: I tied CS to ground. But I imagine what happens is that the next transfer starts too fast, so when I write to the register it gets a write conflict
04:54 AM polprog: spi is a full duplex protocol, 2 shift registers exhange data.
04:54 AM pepijndevos: It seems that making the interval between bytes more, it works perfectly.
04:55 AM polprog: if you want to send a byte after you recvd it from master, then you write that to spdr and master has to issue another 8 clks to read it out
04:55 AM polprog: ie transfer it to it's own shift register
04:56 AM polprog: take a look how for ex fm25v10 protocol looks
04:56 AM polprog: the master has to issue "extra" clocks after he sends the command
04:56 AM pepijndevos: polprog, yes, I know that. The problem seems to be that I did those next 8 clocks too fast, so it got a write conflict some timse.
04:57 AM polprog: master has to wait then.
04:57 AM polprog: for example you can add a "slave ready flag" that gets toggled after the slave finishes command decoding
04:58 AM polprog: and master waits for the signal
04:58 AM polprog: but that adds extra wire to the system
04:58 AM polprog: you can also look at i2c where (IIRC) slave has to ACK master
04:59 AM polprog: correct me if im wrong on that i2c
05:44 AM Haohmaru: i2c?
05:44 AM * Haohmaru pukes
06:13 AM polprog: im not a fan of i2c either
06:37 AM Lambda_Aurigae: never had a problem with it myself.
06:37 AM Lambda_Aurigae: it just works.
06:40 AM Lambda_Aurigae: I even use 4 wire phone cords to make i2c bus connections....2 wires for i2c, gnd, and vcc...so I can power i2c interfaced sensors and such.
06:41 AM Lambda_Aurigae: I have a big box of 4 wire phone cords too...
06:41 AM Tom_L: same here
06:41 AM Lambda_Aurigae: I get 2 or 4 a week usually from new copier installs.
06:42 AM Lambda_Aurigae: most places have phone line in place already when they get a new fax device...so I just keep the new cord.
06:42 AM Lambda_Aurigae: also have a bigger box of 2-wire
06:42 AM Lambda_Aurigae: not sure what to do with those.
06:42 AM Lambda_Aurigae: think I could probably do GND and VCC over them with an AC overlay but that's getting more complex.
06:44 AM Lambda_Aurigae: getting two way comms over that would be tricky.
06:48 AM * Haohmaru sabotages Lambda_Aurigae's i2c
06:50 AM _ami_: i am a big fan of i2c :D
06:51 AM _ami_: it works all the time. :)
06:51 AM _ami_: for me.
06:51 AM * Haohmaru breaks _ami_'s i2c device
06:51 AM _ami_: :)
06:52 AM * Haohmaru turned green like hulk
06:52 AM * _ami_ became thor and ready to fight with hulk
06:52 AM * Haohmaru switches to Bust mode
06:53 AM _ami_: new thor movie seems lots of fun
07:34 AM daey: has anyone tried to use rust for avr programming?
07:35 AM Haohmaru: keep rust away from any electronic equipement
07:35 AM Haohmaru: that's what i was told by the wise men
07:35 AM daey: apparently it has upstream support
07:37 AM daey: but it probably ends up like c i.e. "unsave { your code here }"
07:52 AM Emil: unsafe*
10:04 AM enh: Hi
10:47 AM Lambda_Aurigae: iH
10:47 AM Lambda_Aurigae: daey, guessing it's built into the gcc suite now?
10:48 AM Lambda_Aurigae: daey, looks like gcc has a rust frontend or versa visa...so, one could in theory compile avr-gcc with rust support like one does for fortran or C++ or other gcc supported languages...no clue what might be broken in the translations though.
10:53 AM polprog: as long as you have direct access to memory locations you can manipulate I/O and control registers
10:53 AM polprog: that would be interesting to try rust or even forth on a micro
10:55 AM daey: memory access is done almost the same way as it is done in c. but you have to flag it with unsafe{ access here }
10:56 AM Emil: That's just called writing C ;)
10:56 AM daey: yeah. its probably not so good for avrs
10:56 AM polprog: i heard about netduino today. it's like arduino but programmed in fucking c#
10:57 AM polprog: what do you have to smoke to mate micros and C#
11:02 AM daey: from C++ to C# ? maybe one cig
11:02 AM daey: is arduino even C++? or does it only look like it?
11:03 AM polprog: it's C++ but it uses the library so hard you dont even see main by default
11:04 AM polprog: of you can program it in avr-libc
11:04 AM polprog: in C
11:06 AM polprog: it's a full HAL
11:41 AM antto: if i have to use an arduino, i'd need a full AAL
11:41 AM antto: (arduino abstraction layer)
11:54 AM xentrac: Lambda_Aurigae: using avr-g++ 4.9.2 I get strcpy.cc:4:14: error: ‘strcpy’ was not declared in this scope
12:02 PM antto: smells like you forgot to #include the right header
12:08 PM Lambda_Aurigae: does strncpy work?
12:08 PM LeoNerd: Did someone forget <string.h>
12:09 PM xentrac: well, the background of this discussion is whether g++ will compile strcpy calls if you don't #include the right header
12:09 PM Lambda_Aurigae: I think you need both string.h and stdio.h for it to work.
12:09 PM xentrac: no, string.h is adequate
12:09 PM Lambda_Aurigae: xentrac, I don't remember that conversation.
12:11 PM xentrac: oh, I thought that's what you were takling about when you said
12:11 PM Lambda_Aurigae: "The New Arduino Salvador Dali. Comes complete with 5 STDs and a coupon for a free lobotomy!"
12:11 PM xentrac: 15:16 < Lambda_Aurigae> daey, guessing it's built into the gcc suite now?
12:11 PM Lambda_Aurigae: xentrac, no..that was for daey's talk about rust on avr
12:12 PM xentrac: yeah, I don't think rust will ever be built into the gcc suite
12:12 PM Lambda_Aurigae: I saw somewhere that rust had a gcc frontend or gcc had a rust frontend or something.
12:12 PM Lambda_Aurigae: didn't read any details though.
12:13 PM xentrac: maybe you are thinking of Golang
12:14 PM Lambda_Aurigae: https://gcc.gnu.org/wiki/RustFrontEnd
12:14 PM Lambda_Aurigae: nope...
12:15 PM cehteh: doesnt rust require a GC?
12:15 PM xentrac: no
12:15 PM cehteh: ok
12:15 PM Lambda_Aurigae: no clue..never used rust myself.
12:15 PM cehteh: didnt know
12:15 PM cehteh: because gc on avr would stretch it
12:15 PM antto: you don't "use" rust
12:15 PM antto: you clean it
12:15 PM daey: from what i was reading its supposed to be a drop in replacement for c
12:15 PM antto: or replace the rusted parts with new ones
12:16 PM * antto runs
12:16 PM xentrac: Lambda_Aurigae: that page seems to be about getting Rust Hello World running in GCC in 2015; maybe someone will start working on it again at some point but it is going to be a nontrivial effort
12:17 PM xentrac: cehteh: there was a point at which Rust had garbage-collected allocation, but they stopped that a few years ago
12:17 PM Lambda_Aurigae: xentrac, yeah..that's just what I saw earlier this morning about rust and gcc...as I said, didn't read too far into it.
12:43 PM xentrac: one benefit of Rust's type system is that you can get some of the convenience of garbage-collected allocation without the garbage collector
12:51 PM LeoNerd: static escape analysis :)
01:13 PM Emil: In reality
01:13 PM Emil: C is a shitty language
01:13 PM Emil: All the UB
01:13 PM Emil: All the bad wordings
01:13 PM Emil: All the preprocessor abuse
01:13 PM Emil: I don't understand why people don't just fix C
01:14 PM Emil: Why dedicate resources to creatng a whole new language
01:14 PM Emil: when you could just fix C
01:14 PM antto: yes, append two plusses onto it
01:15 PM polprog: the C i use is nice
01:15 PM polprog: the avr c
01:15 PM polprog: which is a mix of many C
01:15 PM Emil: There is no AVR C
01:15 PM polprog: i kniw
01:15 PM polprog: know*
01:16 PM polprog: maybe i phrased this in the wrong way
01:16 PM Emil: Even though I refer to it as such from time to time :D
01:16 PM antto: avr C is better than microchip C
01:16 PM polprog: i guess that would make it C99?
01:16 PM Emil: antto: hmm
01:16 PM Emil: that's a valid point
01:16 PM Emil: Perhaps I'm wrong
01:16 PM polprog: http://www.nongnu.org/avr-libc/user-manual/index.html
01:16 PM Emil: perhaps it's still valid to call it AVR C to differentiate it from Microshit C
01:17 PM polprog: i mean i like the C that i used in AVR prgramming
01:17 PM Emil: Sure
01:17 PM Emil: but it still allows you to do insane things
01:17 PM Emil: there's UB
01:17 PM polprog: UB?
01:17 PM Emil: bad wordings
01:17 PM antto: isn't there a more recent update to C than C99?
01:17 PM Emil: Undefined behaviour
01:17 PM polprog: ah
01:17 PM Emil: antto: yeah, C17
01:17 PM polprog: well
01:17 PM Emil: Iirc
01:18 PM antto: well, sooner or later, avrgcc will get equipped with it i guess
01:18 PM Emil: Oh it was only C11
01:18 PM polprog: gtg
01:18 PM Emil: polprog: cya
01:19 PM antto: avrgcc: equip yourself!
01:41 PM enh_mobile: Oh, my. I washed my nickname and now it shrunk!
04:16 PM day_ is now known as daey
04:58 PM polprog: \o/ got a t420!
05:17 PM Emil: http://ncase.me/trust/
05:25 PM Lambda_Aurigae: polprog, dell server t420?
05:33 PM Emil: I think the laptop
05:33 PM Lambda_Aurigae: oh.
05:33 PM Lambda_Aurigae: because I got a dell poweredge t420 server here...nice box.
05:34 PM Lambda_Aurigae: dual 2.8ghz xeons with 32GB ram and 6 147GB 15krpm dual channel SAS drives.
05:34 PM Lambda_Aurigae: free discard from work.
06:09 PM JanC_ is now known as JanC
11:48 PM Thrashbarg_ is now known as Thrashbarg