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

    how to determine which processor module i'm using?

    Scheduled Pinned Locked Moved WiPy 2&3
    4 Posts 3 Posters 136 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.
    • C Offline
      cYc
      last edited by

      hi all,
      i'm writing code to execute on either a WiPy or a GPy.
      i need to determine at run time which module the code is running on so i can initialise LTE (GPy) or not (WiPy)
      aside from using the try...except method to check for LTE modem presence is there an object i can query for a device id

      i can't seem to find anything in the documentation.

      any help will be appreciated

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

        @cYc sys.platform will tell you.

        import sys
        print (sys.platform)

        C A 2 Replies Last reply Reply Quote 0
        • C Offline
          cYc @robert-hh
          last edited by

          @robert-hh
          many thanks for the speedy reply
          exactly what i needed

          1 Reply Last reply Reply Quote 0
          • A Offline
            andreas @robert-hh
            last edited by andreas

            Dear @cYc,

            @cYc said in how to determine which processor module i'm using?:

            I need to determine at run time which module the code is running on so i can initialise LTE (GPy) or not (WiPy) aside from using the try/except method.

            @robert-hh said in how to determine which processor module i'm using?:

            import sys
            print(sys.platform)

            If you will need a more extensive platform switch, you are welcome to take our implementation [1] from the Universal MicroPython Application Loader.

            More or less, it just wraps sys.platform and sys.implementation.

            We are using it to run the Terkin-Datalogger on both ESP32 and STM32 plaforms and to decide whether it is running on Pycom MicroPython or Genuine MicroPython.

            platform_info = PlatformInfo()
            
            if platform_info.mcu == platform_info.MCU.ESP32:
                print('Running on ESP32')
            elif platform_info.mcu == platform_info.MCU.STM32:
                print('Running on STM32')
            
            if platform_info.vendor == platform_info.MICROPYTHON.Pycom:
                print('Running on Pycom MicroPython')
            elif platform_info.vendor == platform_info.MICROPYTHON.Vanilla:
                print('Running on Genuine MicroPython')
            

            With kind regards,
            Andreas.

            [1] https://github.com/hiveeyes/hiveeyes-micropython-firmware/blob/8ced0b29f6b5cc7061b9d78f545293a5b804a5ab/lib/umal.py#L10-L77

            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