spi on fopy
-
Want to use mosi on the fipy but it says it's a external antenna switch. What is this pin for and can I use this pin for spi?
-
@misterlisty Since this P12 is used for the antenna switch, you cannot use it for MISO. But you can use any other Pin for SPI. P12 is just the default setting. You can specify these Pins in the constructor of the SPI object (see the docs: https://docs.pycom.io/chapter/firmwareapi/pycom/machine/SPI.html). Please consider, that P13 to P18 are input only, so they cannot be used for MOSI or CLK, and P15, P17 and P18 are used for the LTE modem.
That's the downside of the many functions: fewer Pins available for own usage. -
thanks, when i setup SPI, what if i just want to setup MOSI pin? is this possible? The syntax appears to want clk, mosi, miso
-
@misterlisty You would at least need CLK and MOSI. But if you want to change only one Pin, you could specify the default values for the others.
-
chain = WS2812(spi_bus=2,ledNumber=3) data = [ (255, 0, 0), # red (0, 255, 0), # green (0, 0, 255) # blue ] chain.show(data) #modified part of ws2812 def __init__(self, spi_bus=0, ledNumber=1, intensity=1): """ Params: * spi_bus = SPI bus ID (1 or 2) * led_count = count of LEDs * intensity = light intensity (float up to 1) """ self.led_count = ledNumber self.intensity = intensity # prepare SPI data buffer (4 bytes for each color) self.buf_length = self.led_count * 3 * 4 self.buf = bytearray(self.buf_length) # SPI init self.spi = SPI(spi_bus, SPI.MASTER, baudrate=3200000, polarity=0, phase=1, pins=('P23','P22')) #modified # turn LEDs off self.show([])Get an error on line 56..resource not available...
line 56= self.spi = SPI(spi_bus, SPI.MASTER, baudrate=3200000, polarity=0, phase=1, pins=('P23','P22'))
-
@misterlisty From the docs "(spi_)id can only be 0". And you have to specify the MISO pin
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login