*** tpb has joined #timvideos | 00:00 | |
*** sb0 has joined #timvideos | 02:36 | |
CarlFK | anyone up on spi and python? | 02:55 |
---|---|---|
CarlFK | I've been at this for 12 hours. my simple python code is super random, the simple C code is fine | 02:56 |
CarlFK | https://github.com/petrockblog/RPi-MCP23S17 "The following demo" is what I am trying to run | 02:58 |
tpb | Title: GitHub - petrockblog/RPi-MCP23S17: This Python module abstracts the GPIO expander MCP23S17 for usage on the Raspberry Pi. (at github.com) | 02:58 |
CarlFK | C code that works fine https://github.com/CarlFK/Ripley-1/blob/master/src/tests/23s17.c | 02:58 |
tpb | Title: Ripley-1/23s17.c at master · CarlFK/Ripley-1 · GitHub (at github.com) | 02:58 |
*** ewen has joined #timvideos | 03:28 | |
*** rohitksingh_work has joined #timvideos | 04:49 | |
thaytan | hey CarlFK | 05:02 |
CarlFK | hey thaytan | 05:02 |
CarlFK | if you are interested in my spi fun, I just filed a pretty well defined bug report https://github.com/petrockblog/RPi-MCP23S17/issues/10 | 05:03 |
thaytan | it's not using the RPI SPI hardware | 05:04 |
thaytan | but bit-banging GPIOs | 05:04 |
thaytan | might be a timing issue in python | 05:04 |
CarlFK | There is spi hardware?!! | 05:07 |
CarlFK | rage. | 05:08 |
thaytan | https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md | 05:08 |
CarlFK | MOSI P1-19 MISO P1-21 i'm doing that | 05:10 |
thaytan | oh, I'm wrong | 05:12 |
thaytan | misread the code - it is importing the python spidev module and using that | 05:12 |
thaytan | so should use the hw SPI if it's enabled | 05:12 |
CarlFK | whew. | 05:12 |
thaytan | did you enable the SPI in the rpi config? | 05:15 |
CarlFK | yes | 05:15 |
thaytan | cool | 05:15 |
CarlFK | pi@cccpi:~ $ lsmod |grep spi | 05:15 |
CarlFK | spidev 7220 0 | 05:15 |
CarlFK | spi_bcm2835 7520 0 | 05:15 |
thaytan | parfait | 05:17 |
CarlFK | are you familiar with http://wiringpi.com/the-gpio-utility/ | 05:24 |
tpb | Title: The GPIO utility | Wiring Pi (at wiringpi.com) | 05:24 |
CarlFK | gpio -x mcp23s08:123:0:0 awrite 0 1 | 05:25 |
CarlFK | gpio -x mcp23s08:123:0:0 aread 0 | 05:25 |
CarlFK | 0 | 05:25 |
CarlFK | I expeted 1. kinda. not really sure about the 123:0:0 | 05:25 |
thaytan | I've done Rpi SPI stuff, but not recently | 05:27 |
CarlFK | same withe write/read | 05:27 |
thaytan | maybe the spidev module configures a different SPI speed? | 05:27 |
CarlFK | that's kinda my guess | 05:27 |
thaytan | you could try dropping the frequency | 05:27 |
CarlFK | im not sure how | 05:27 |
CarlFK | Re: Change SPI Speed From Python https://www.raspberrypi.org/forums/viewtopic.php?t=37550#p320028 | 05:29 |
CarlFK | ImportError: No module named 'spydev' | 05:29 |
thaytan | https://pypi.org/project/spidev/ says you can set spi.max_speed_hz = 5000 on the spidev module | 05:30 |
tpb | Title: spidev · PyPI (at pypi.org) | 05:30 |
CarlFK | are you sure that code was using the spydev module? | 05:31 |
thaytan | so MCP23S17._spi.max_speed_hz = 5000 for example | 05:31 |
CarlFK | import spidev https://github.com/petrockblog/RPi-MCP23S17/blob/master/RPiMCP23S17/MCP23S17.py#L29 | 05:31 |
tpb | Title: RPi-MCP23S17/MCP23S17.py at master · petrockblog/RPi-MCP23S17 · GitHub (at github.com) | 05:31 |
thaytan | CarlFK, good luck. I'm going afk | 05:33 |
CarlFK | see ya - thanks for the tips | 05:33 |
ewen | xobs: re your questions earlier about fupy (which I've just spotted in IRC logs): fupy is essentially a clone of upstream micropython, with a ports/fupy directory added that builds micropython against a litex environment (including getting generated csr.h, etc, copied in). | 06:42 |
ewen | xobs: I suspect it only properly builds in the context of litex-buildenv at present (scripts/build-micropython.sh) due to the files copied in. | 06:43 |
xobs | ewen: I thought it might be something like that. | 06:43 |
xobs | I wasn't sure if it required any other patches. | 06:43 |
ewen | xobs: Also last I knew only the lm32 CPU version *actually worked*. There's incomplete ports to or1k and risc-v, but IIRC each time people checked they found they didn't work to boot properly. | 06:43 |
ewen | xobs: In theory if you use litex-buildenv, scripts/build-micropython.sh, and lm32 as the soft CPU, it should build. IIRC I last tested it about 3 months ago. | 06:44 |
xobs | I created the usb-cdcacm Fomu example project as a precursor to trying Fupy again. | 06:44 |
ewen | xobs: For your purpose (vexriscv) I suspect it'd probably help if someone made sure the RISC-V fupy (or micropython?) actually worked... | 06:45 |
ewen | ... which last I knew it didn't, for reasons unknown. | 06:45 |
CarlFK | lm32 and risk-v are different endian (circuit-python dropped support for one) | 06:52 |
xobs | I thought they dropped support fir Big, because nearly everything today is Little. | 06:53 |
xobs | (including RISC-V) | 06:53 |
futarisIRCcloud | I suspect there is less work in getting Zephyr to run. First thing we need to do is get a qemu litex model for vexriscv. | 06:59 |
CarlFK | I could be wrong - I was making a run to port circuit-python using the patches to micro-python and bumped was told something like "not a chance... because endian" | 07:04 |
ewen | FTR, last I knew riscv/or1k micropython didn't produce any serial output at all (ie, didn't even boot). That could be endian issues I suppose, but in practice I'd expect endian issues to be more subtle (ie, some things work, other things go wrong). | 07:17 |
ewen | (My guess is that there are IRQ / serial / etc things not wired up right for those cPUs.) | 07:17 |
ewen | Also FTR my recollection is last time fupy was sync'd with upstream micropython was when I did it at PyConAU 2018 (August 2018); there's been at least one upstream MicroPython release since then. | 07:18 |
ewen | xobs: Also in case it helps, fupy has only ever been used with hard wired serial (ie, no USB CDC support). Eg, on TinyFPGA BX it's only usable via external USB-serial. (On some other platforms like Mimas V2 / Arty it relies on the FTDI, etc, chip on the board to convert hardwired serial to USB.) For your purposes that might be a show stopper, depending on FPGA space needed for USB stack including hard | 07:28 |
ewen | wired serial to USB CDC logic... | 07:28 |
xobs | ewen: why would it need hard-wired USB CDC logic? | 07:33 |
ewen | xobs: as currently used MicroPython brings up a REPL, for interaction via a serial port. | 07:34 |
ewen | xobs: that serial port is basic RS232-style serial port from the soft-CPU devices. | 07:35 |
ewen | xobs: For the Fomu only the EVT has a TX/RX serial port connection... so to work for hacker/production Fomu it'd need something to tunnel serial IO out via USB... | 07:35 |
xobs | That was my plan. To have it enumerate as a CDC ACM device over USB, and present a normal serial port to Micropython. | 07:36 |
ewen | (I guess it'd be possible to use MicroPython only via pre-loaded .py files, if there was some method provided to upload them. But seems like debugging would be non-trivial :-) ) | 07:36 |
xobs | Or does micropython require more over USB? | 07:36 |
xobs | Like, does it require MSC? | 07:36 |
ewen | MicroPython itself doesn't require any USB AFAIK. | 07:37 |
ewen | Both for REPL with no physical serial wiring, it'd help to have some way to show the user the REPL/console/serial IO... :-) | 07:37 |
ewen | xobs: https://docs.micropython.org/en/latest/library/pyb.USB_VCP.html seems to some extension. (Not sure if the same approach can be used for the MicroPython REPL.) | 07:38 |
tpb | Title: class USB_VCP – USB virtual comm port MicroPython 1.10 documentation (at docs.micropython.org) | 07:38 |
ewen | xobs: Ah, I've realised what you're asking about re MSC (USB Mass Storage). Yes, ideally MicroPython would have access to some storage it could load .py files from. But IIRC it can run entirely with what's pre-linked in, plus user-entered Python at REPL. | 07:41 |
*** ewen has quit IRC | 09:32 | |
futarisIRCcloud | https://github.com/micropython/micropython/tree/master/ports/zephyr | 09:37 |
tpb | Title: micropython/ports/zephyr at master · micropython/micropython · GitHub (at github.com) | 09:37 |
*** mauz555 has joined #timvideos | 12:21 | |
*** futarisIRCcloud has quit IRC | 12:49 | |
*** rohitksingh_work has quit IRC | 12:58 | |
xobs | I got it to the point where it initialized and printed out a banner, but I think the gc was causing all sorts of issues. Need to investigate that. | 14:39 |
CarlFK | neat | 14:40 |
xobs | I don't know if that's a "well it's almost there" issue, or a "computer vision as a summer project in 1966" kind of issue. | 14:41 |
CarlFK | lol | 14:41 |
CarlFK | sounds like my spi problem. I'm sure I just need to set a setting and it will all just work | 14:42 |
CarlFK | do you have a MCP23S17 and an hour to wire it up and debug my problem? :D | 14:43 |
daveshah | Have you seen https://github.com/mmicko/micropython/tree/legacy/ports/picorv32? micko got micropython working on picorv32 | 14:44 |
tpb | Title: micropython/ports/picorv32 at legacy · mmicko/micropython · GitHub (at github.com) | 14:44 |
xobs | daveshah: I hadn't seen that, neat! | 14:46 |
xobs | It could be that my implementation of setjmp/longjmp is bad, and I should just let it link in libc. But last time I tried that the code size blew up. | 14:50 |
daveshah | I've seen crashing after the banner before, turned out I had a libc built for rv32ic but picorv32 configured as rv32i | 14:51 |
xobs | I was getting a ton of corruption. Bad USB descriptors, frequently failing builds, that sort of thing. | 14:52 |
xobs | I thought it could be a caching issue, because it kind of smells like one. But I still think it's the gc running oddly. | 14:52 |
xobs | How does this thing even work? It looks like the gc searches the stack between main() and when gc_collect() gets called, which doesn't seem right. | 15:25 |
*** Toba has quit IRC | 15:36 | |
*** mauz555 has quit IRC | 16:42 | |
*** mauz555 has joined #timvideos | 16:43 | |
*** mauz555 has joined #timvideos | 16:43 | |
*** mauz555 has quit IRC | 17:01 | |
*** mauz555 has joined #timvideos | 19:00 | |
*** Toba has joined #timvideos | 19:11 | |
*** Toba is now known as Guest51193 | 19:11 | |
*** mauz555 has quit IRC | 19:20 | |
*** puck_ has quit IRC | 19:37 | |
*** CARAM_______ has quit IRC | 21:02 | |
*** CARAM_______ has joined #timvideos | 21:09 | |
*** CARAM_______ has quit IRC | 21:10 | |
*** CARAM_______ has joined #timvideos | 21:16 | |
*** mauz555 has joined #timvideos | 22:00 | |
CarlFK | in CPX land: It looks like I’ll need to upgrade to at least a slightly better logic analyzer to be able to capture full speed USB. | 22:02 |
*** techman83 has quit IRC | 22:06 | |
*** fischerm has quit IRC | 22:06 | |
*** springermac has quit IRC | 22:07 | |
*** fischerm has joined #timvideos | 22:07 | |
*** techman83 has joined #timvideos | 22:07 | |
*** ChanServ sets mode: +v techman83 | 22:07 | |
*** springermac has joined #timvideos | 22:09 | |
*** springermac_ has joined #timvideos | 22:15 | |
*** springermac has quit IRC | 22:15 | |
*** springermac_ is now known as springermac | 22:15 | |
*** thaytan has quit IRC | 22:18 | |
*** thaytan has joined #timvideos | 22:20 | |
*** ChanServ sets mode: +v thaytan | 22:20 | |
*** paddatrapper_ has joined #timvideos | 22:22 | |
*** paddatrapper has quit IRC | 22:24 | |
*** mauz555 has quit IRC | 22:24 | |
*** medicalwei has quit IRC | 22:27 | |
*** medicalwei has joined #timvideos | 22:27 | |
*** futarisIRCcloud has joined #timvideos | 23:01 | |
*** CarlFK has quit IRC | 23:02 | |
futarisIRCcloud | CarlFK: What do you want to capture full speed USB for? There was good video that outlined the (cheap) options (on #timvideos or #tomu) a few weeks ago... | 23:04 |
CarlFK[m] | I don't, someone else said that. I see it didn't copy paste his Nick. I'll follow up on that in an hour or so. | 23:05 |
futarisIRCcloud | xobs / daveshah: That micropython for riscv32 looks promising. Any idea why it's not upstream? | 23:06 |
futarisIRCcloud | CPX land? | 23:06 |
futarisIRCcloud | https://github.com/mmicko/micropython/commit/e6240249a18cc7bfc11b13002ac999d5691e013d - seems to have the main diff... | 23:12 |
tpb | Title: Aded RISCV support for Freedom-E-SDK boards · mmicko/micropython@e624024 · GitHub (at github.com) | 23:12 |
futarisIRCcloud | https://github.com/mmicko/micropython/commits/legacy?author=mmicko seems to be an older branch. | 23:12 |
tpb | Title: Commits · mmicko/micropython · GitHub (at github.com) | 23:12 |
Generated by irclog2html.py 2.13.1 by Marius Gedminas - find it at mg.pov.lt!