Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    LoPy4 reuse SPI pins?

    Scheduled Pinned Locked Moved LoPy
    lopy4spigpio
    4 Posts 3 Posters 1.3k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E Offline
      Electrozest
      last edited by

      I am designing a complex circuit with the LOPY4 which requires both I2C and SPI and I am running out of spare GPIO pins.

      Is it possible to use the MISO,MOSI and CLK lines connected to the Sigfox/Lora radio module if I run individual chip select line to each of my own SPI devices using the available GPIOs?

      Essentially I didn't want to use up all of my GPIO allocations on an additional SPI interface if I can reuse the one provided and ensure that each SPI device has a separate GPIO chip select.

      It looks like the radio module has an SPI chip select on GPIO17, so if this is set as disabled, I assume the SPI bus is then free and I could use my own SPI devices via these pins?

      Thanks.

      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @Electrozest
        last edited by

        @electrozest If you can avoid a collision, then it may should be possible, especially if you do NOT change the SPI mode. I do not know, how the radio driver is implemented. But as a first guess, I would not expect to reconfigure SPI on every use.

        1 Reply Last reply Reply Quote 0
        • D Offline
          daniel
          last edited by

          @Electrozest what you want can be done in theory, but we haven't tried it ourselves. In principle you would have to limit the use of the shared SPI bus and be careful that the LoRa stack is not busy with anything while you communicate with your other slave. We could offer support for this and modify our code base if needed to make it work. Let us know.

          E 1 Reply Last reply Reply Quote 0
          • E Offline
            Electrozest @daniel
            last edited by Electrozest

            Thanks @daniel and @robert-hh and thank you for the offer of support and potential of modifying code base.

            I decided to use a PCA8575 16 bit I2C I/O expander as it solved the I/O problem without adding too much to the bill of materials, so I left the SPI pins for the Lora/Sigfox radio not connected.

            1 Reply Last reply Reply Quote 0

            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
            • 1 / 1
            • First post
              Last post

            Pycom on Twitter

            Pycom