🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Micropython SPI

    Micropython
    6
    12
    22.1k
    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.
    • J
      jwrm22
      last edited by jwrm22

      1.3.2 does not contain the I2C/SPI etc. in the machine module.

      1.2.3 does include SPI but none of the other code works as uiflow module does not exist.

      1 Reply Last reply Reply Quote 0
      • C
        crami25
        last edited by

        @jwrm22 Want to brick your ESP32 with SPI programming ?

        see http://community.m5stack.com/topic/1840/issues-interfacing-mfrc522-rfid-with-m5stack

        Using GPIO4 CS ? It is used as CS on the micro SD card reader of the M5Stack: You either have to solder a wire to your ESP32:

        0_1586717155260_9ef98010-a52f-4a4e-9e6a-79b669499a82-image.png

        or make a micro sd card adapter connecting wires to micro sd card:0_1586716832850_75d899e5-34fd-4672-9285-01744d8e4c14-image.png
        GPIO4 is on your microSD Pin 2 !
        You can get all the SPI signals you wanted in the sd Micro card adapter ! https://github.com/m5stack/M5-Schematic/blob/master/Core/Basic/M5-Core-Schematic(20171206).pdf
        0_1586717905380_fba69185-f178-408f-918d-707836984713-image.png

        Your copy and paste Micropython code from the M5Stack reference is the basic API reading/writing to the SD (SPI) micro card !

        0_1586719044843_2c44b6a7-a9ee-453a-839f-f0eff2d2973e-image.png

        1 Reply Last reply Reply Quote 0
        • J
          jwrm22
          last edited by

          While I understand that the SPI is used for the SD card.
          On the back of the m5stack SPI is clearly broken out. No hand soldering required.
          I do not need CS it's just what's used as example.

          There is an implementation in the sited m5stack git source on software SPI on different pins.
          I'm just annoyed the software and documentation are not in sync.
          Do you know where I can find the source used to build 1.4.5.1 for instance?

          I'll see if I can find the code to read/write to the SD card.

          1 Reply Last reply Reply Quote 0
          • J
            jwrm22
            last edited by

            I do not have enough knowledge of python or git to find the files that write SPI.
            I've found some .c files but don't know what to do with them.

            1 Reply Last reply Reply Quote 0
            • T
              Thrasher
              last edited by

              Anyone tried flashing m5 stack basic device with raw micropython? Will it brick the device? I doubt that. Raw micropython works just fine with atom and reflashes to uiflow just okay.

              T 1 Reply Last reply Reply Quote 0
              • C
                crami25
                last edited by

                @ you can find the micropython SPI API in the microphyton reference:
                https://docs.micropython.org/en/latest/esp32/quickref.html#software-spi-bus
                M5Stack has a repository hooking up a SPI TFT display to the M5Stack on github:
                https://github.com/m5stack/M5Stack_TFT_ILI9341

                They are using following Pins for the Hardware SPI bus (vspi, ID channel 2) in order not to have any conflicts with the built in components:
                MOSI: 23
                MISO: 19
                SCK : 18
                CS: 5 (Display CS)
                DC: 26 (display DC)
                TCS: 25 (touch screen CS)

                1 Reply Last reply Reply Quote 0
                • J
                  jwrm22
                  last edited by

                  @crami25 Ok. SPI is used both for the SD card and TFT.
                  The link to the micropython docs is not the same as any of the m5stsck firmware.
                  The SPI in the machine module does not exist.

                  Can you tell me how I install or add SPI to a micropython build?

                  1 Reply Last reply Reply Quote 0
                  • T
                    tialm @Thrasher
                    last edited by

                    @thrasher I did it and it works fine. The only downside is that M5Stack doens't give you their micropython libraries to work with... They claim they are open source ( and that was why I got into it) but then they don't share the sources that we need to make the best of the hardware.. I have asked for some in other posts and got no reply

                    ajb2k3A 1 Reply Last reply Reply Quote 0
                    • T
                      Thrasher
                      last edited by

                      As well as any decent documentation. Its a known problem

                      1 Reply Last reply Reply Quote 0
                      • lukasmaximusL
                        lukasmaximus
                        last edited by

                        @jwrm22 SPI can be found in machine module

                        from machine import SPI
                        
                        
                        1 Reply Last reply Reply Quote 0
                        • ajb2k3A
                          ajb2k3 @tialm
                          last edited by

                          @tialm The problem is that the firmware is constantly changing as they work to ix bugs in the firmware. They are working to get it up to the same level as mainstream Micropython but its slow going.
                          I'm currently digging through demo and examples (that I'm creating) to find the API's but its slow going due to the rapidly changing firmware.

                          UIFlow, so easy an adult can learn it!
                          If I don't know it, be patient!
                          I've ether not learned it or am too drunk to remember it!
                          Author of the WIP UIFlow Handbook!
                          M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post