Sunday, 2018-11-18

*** tpb has joined #timvideos00:00
* mithro forgets how to put the analyzer in a different clock domain...00:00
*** samsagaz has quit IRC00:11
*** samsagaz has joined #timvideos00:14
mithrobe back later...00:16
mithrotannewt: one thing that might be worth trying, getting your tinyusb to compile and link inside the buildenv even if there is no USB device to drive yet00:28
mithroxobs: Have you used litescope recently?01:46
mithroHrm, I can't seem to figure out why litescope doesn't seem to be seeing these values change...01:55
tannewtmithro, ya I can look into it. does the build env have more than a compiler in it?02:05
mithroYou mean does it have a libc?02:06
tannewtmy linux box is still very flaky so I may end up giving up and working to get the ice40 tools going on mac02:06
cr1901_modernmithro: Presumably you remembered ClockDomainsRenamer by now :P?02:06
mithrotannewt: Linux VM on your Mac maybe?02:07
mithrocr1901_modern: yes, I was trying to figure out the args before02:07
tannewtmithro: I'm wondering what it provides exactly. It'd be nice to keep the deps to a minimum02:07
tannewtmac can run most linuxy things natively just fine02:08
mithrotannewt: by default there is a pretty minimal C stuff02:08
mithroThere is also a newlib option02:08
cr1901_modernI imagine you can build a gcc cross compiler on Mac just fine02:09
tannewtright, I'm just thinking I'll need the lm32 toolchain02:09
cr1901_moderntannewt: lm32 is probably one of the easiest toolchains to cross-compile02:09
cr1901_modernFollow step #4 here:
tpbTitle: GitHub - m-labs/misoc: A high performance and small footprint system-on-chip based on Migen (at
tannewtkk, will follow that if I give up on linux02:10
tannewtcurrently running top and tailing dmesg to see if I can spot the problem02:11
tannewtdefinitely have unhappy usb02:11
mithroI mean, it would be good if the setup supported Mac, but it's a pretty big yac shave...02:11
tannewtya, totally. that's why if I can reduce it to needing a gcc toolchain and icestorm I'd be happy02:13
mithroI think I have scoping of the USB working....
xobsOoh, awesome!03:39
mithroThe NAK would be coming from the FPGA, right?03:44
xobsNo, looks like either a lower level signaling problem, or an invalid device configuration struct.03:48
mithroxobs: Hrm?04:42
CarlFKmithro: any idea what color wires I should use for the 2 usb datalines?04:43
mithroCarlFK: It's defined somewhere...05:14
tpbTitle: What Each Colored Wire Inside a USB Cord Means | TurboFuture (at
CarlFKmithro: I've been clicking around
CarlFKyou have better click foo05:15
mithroRed color indicates the positive wire with 5 volts of DC power.05:15
mithroBlack has always been the ground wire in almost all electronic devices.05:15
mithroWhite is the data as a "positive" wire, while05:15
mithroGreen is also for the data , but as the negative wire.05:15
mithroWell, this is frustrating, it seems to work with icecube2 but not nextpnr05:28
CarlFKmithro: good.  this random cable pulled from a desktop case is perfect:05:28
* CarlFK[m] uploaded an image: 20181117_232130.jpg (360KB) < >05:28
mithroYay, I got it to ACK!05:46
*** rohitksingh has joined #timvideos05:51
tannewtmithro: awesome!05:53
tannewtmithro what core are you using?05:54
mithrotannewt: tinyfpga's05:55
tannewtah, I mean cpu05:55
tannewttinyusb example code is here:
tpbTitle: tinyusb/examples/device/device_composite/src at develop · hathach/tinyusb · GitHub (at
tannewtno makefile yet though, only the segger ide stuff05:56
tannewthow is data moved to and from the usb peripheral? direct ram access or dma?05:57
*** rohitksingh has quit IRC06:01
mithrotannewt: That doesn't work yet06:05
mithrotannewt: Still working the level below that06:05
*** rohitksingh has joined #timvideos06:40
mithrotannewt: How good if your USB data payload decoding?06:56
tannewttry me :-)06:56
mithroAny idea what [0x80, 0x06, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00] says?06:56
tannewtsetup packet06:56
tannewtI think its get descriptor 106:57
tannewtlength 0x004006:57
tannewtya, the 0x80 is on ctrl IN I think06:58
xobsmithro: what could be happening is that the PHY/MAC is incorrectly decoding that packet as something that it doesn't know about.06:58
xobsYou're supposed to NAK any setup packets that you don't recognize.06:58
xobsSo apologies, it's likely the device that's NAKing.06:59
mithroxobs: yes, but it is nacking / acking -- that is all I was trying to get out of that06:59
mithroxobs: IE the device was responding to the input in some way06:59
mithrotannewt: So what does a set address usb packet look like?07:00
tannewtI see that on linux sometimes before the set address packet07:00
xobsOh!  Yes.  You should be able to have it respond with a valid descriptor header now.07:00
tannewtI can grab a capture for you shortly07:01
xobsmithro: byte 0 of the SETUP is 0, and byte 1 is 5 (for SET_ADDRESS)07:02
xobsYou send a zero-length DATA packet when you get that.07:03
mithrodata0 [00 05 0C 00 00 00 00 00]07:03
xobsYes, that's saying to set the address to 0xc07:04
xobsThe state machine for my bitbanged USB stack is at, and this is in grainuum_state_process_setup()07:04
mithrotannewt: Any idea why its occurring before the set address packet?07:07
tannewtits a Linux thing07:08
tannewtI'm on my mac but will grab a sequence with a linux box07:08
*** rohitksingh has quit IRC07:16
*** sb0__ has quit IRC07:24
tannewtwith my mac
tannewtI have a BIOS prompt!07:42
tannewtand now I have repl!07:44
tannewtI got a kick out of the pause while it thought about "1+1" :-)07:57
*** fischerm has quit IRC08:00
*** fischerm has joined #timvideos08:00
CarlFKtry something hard, like  1+1.008:00
tannewtseems simila08:01
CarlFKnow I am pondering what implements floating point math: the python vm or the cpu or what?08:04
xobsCarlFK: usually it's the libc that does that.08:05
tannewtthe cpu if its available08:11
*** rohitksingh has joined #timvideos08:18
tannewtis python actually run by migen? I'm wondering if we should use Python docstrings for documentation08:18
*** rohitksingh has quit IRC08:26
*** rohitksingh has joined #timvideos08:58
*** rohitksingh has quit IRC08:59
*** rohitksingh has joined #timvideos09:01
mithrotannewt: Yes you should use Python doc strings09:23
tannewtBut we can’t read back the attribute strings09:28
tannewtI want a data sheet :-)09:29
tannewtI’ll sleep on how to structure it so we can document it. :-)09:30
xobstannewt: I've been trying to figure out how to get migen to generate datasheets, too.09:32
tannewtNice! What have you explored?09:33
tannewtI think class level attributes have doc strings associated with them09:34
xobsNot much right now.  I was planning something more generic, something that could generate reference manuals from SVD files.  Then have migen generate SVD files.09:34
tannewtThat would be cool too!09:35
tannewtwhat would we need to do that besides register level docs?09:37
xobsI'd like something that renders the register maps.  Those pictures are so very very useful.09:39
xobsI think it might be possible to render them as HTML, though.09:39
tannewtgot an example?09:40
xobsI wonder if this works...09:42
* xobs uploaded an image: image.png (412KB) < >09:42
tannewtya, cool09:42
tannewtI think we have all of that info except the description09:43
xobsAll of that information is present in an svd file, too.  So it's possible to e.g. go from svd to C header files, or to rust accessors.  What we don't yet have is something to generate the pdf, because by-and-large those PDFs come from the chip vendors and they're all done by hand in Word.09:45
tannewtya, migen just outputs a csv at the moment09:47
xobsAnd a header file that you can use in C code.09:48
tannewtah, I haven't seen that yet09:49
xobsI added a patch that lets you #include "csr.h", and use it when debugging C drivers on the host.09:50
mithroHave you seen wavedrom?09:50
mithroWell, I now have a test bench which replicates the hardware behaviour09:51
xobsmithro: cool!09:51
mithroAnd can make it respond with nak or ack09:51
mithroAnd I can see were the data out of the packet should be shoved09:52
mithroSo, I think I'm going to head home to bed09:52
mithroxobs: wavedrom already has a sphinx plugin too...09:52
xobscongratulations. sleep well.09:52
tannewtbedtime for me too. night!09:56
xobsfancy.  This all with a UP5K?09:57
mithroxobs: That is all simulation09:59
xobsOoh, also fancy.10:00
mithroxobs: But it matched the behaviour I was getting on the tinyfpga bx10:00
tpbTitle: valentyusb/ at master · mithro/valentyusb · GitHub (at
*** rohitksingh has quit IRC10:23
*** rohitksingh has joined #timvideos12:27
* xobs uploaded an image: tomu-fpga-evt1-front.jpg (319KB) < >12:35
*** rohitksingh has quit IRC12:39
*** rohitksingh has joined #timvideos12:41
*** rohitksingh has quit IRC12:54
*** rohitksingh has joined #timvideos12:56
*** rohitksingh has quit IRC13:19
*** rohitksingh has joined #timvideos13:34
*** rohitksingh has quit IRC13:44
*** rohitksingh has joined #timvideos13:59
*** rohitksingh has quit IRC14:02
*** lexano has quit IRC16:01
*** Kripton has quit IRC16:27
*** Kripton has joined #timvideos16:28
*** rohitksingh has joined #timvideos16:56
*** rohitksingh has quit IRC18:07
*** rohitksingh has joined #timvideos18:17
*** springermac has quit IRC19:46
*** springermac has joined #timvideos19:46
*** rohitksingh has quit IRC20:04
mithroxobs: is U10 the RGB led?20:16
mithroxobs: still think you'll regret not having more user controlled LEDs :-P20:17
mithrotannewt: just about to head into the office to continue the USB stuff20:18
mithrotannewt: you know what would be super handy, if someone added USB packet decoding to sigrok... Hint hint20:40
*** TheAssassin has quit IRC20:42
mithrotannewt: if ya really good, figure out a way to use Wireshark decoders in sigrok :-P20:43
mithroThe J and K symbols in the USB keep making me think it's joking20:57
tpbTitle: GitHub - adafruit/beaglecap: Capture from a Beagle 12 into Wireshark (at
tannewtthat can take usb packets and wrap them into what wireshark is used to21:00
mithrotannewt: apparently sigrok already has some of this feature according to #sigrok21:02
mithrotannewt: I try to use free or cheap tools as much as possible :-P21:02
tannewtI'm happy to expand that parsing as well21:07
mithro 'sigrok-cli -P usb_request --show' suggests that there's -B pcap, 'git grep pcap' in sigrok-dumps points to usb/setup/README21:08
tpbTitle: Git - sigrok-dumps.git/blob - usb/setup/README (at
*** techman83 has quit IRC22:06
*** techman83 has joined #timvideos22:07
*** ChanServ sets mode: +v techman8322:07
mithroSo, I don't quite understand how big the DATA0 packets should be?23:08
mithroFor full speed endpoints, the maximum bulk packet size is either 8, 16, 32 or 64 bytes long.23:10

Generated by 2.13.1 by Marius Gedminas - find it at!