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

    Roller485 with PWRCAN and CORE

    Modules
    1
    2
    43
    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.
    • I
      iorex
      last edited by

      Hello,
      I am trying to get a Roller485 to work with a POWRCAN module attached to a CORE controller but I don't seem to get it to run.
      Please note that it does work over I2C.
      Here's the configuration:

      POWERCAN:
      12V, line A to line A, line B to line B, TX:G17, RX:G16, terminator enabled.
      Roller485:
      RS485, node #:1, 115200 Baud, MODE: Speed

      I am attaching the UIFlow2 application.
      Thank you for your support.

      import os, sys, io
      import M5
      from M5 import *
      from module import PwrCANModuleRS485
      from unit import Roller485Unit
      
      
      
      label0 = None
      pwrcan_0 = None
      roller485_0 = None
      
      
      def setup():
        global label0, pwrcan_0, roller485_0
      
        M5.begin()
        Widgets.setRotation(1)
        Widgets.fillScreen(0x222222)
        label0 = Widgets.Label("label0", 38, 38, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)
      
        pwrcan_0 = PwrCANModuleRS485(2, baudrate=115200, bits=8, parity=None, stop=1, tx=17, rx=16)
        roller485_0 = Roller485Unit(pwrcan_0, address=1, mode=Roller485Unit.RS485_MODE)
      
      
      def loop():
        global label0, pwrcan_0, roller485_0
        label0.setText(str('Label'))
        roller485_0.set_motor_mode(1)
        roller485_0.set_motor_speed(100)
        roller485_0.set_speed_max_current(100)
      
      
      if __name__ == '__main__':
        try:
          setup()
          while True:
            loop()
        except (Exception, KeyboardInterrupt) as e:
          try:
            from utility import print_error_msg
            print_error_msg(e)
          except ImportError:
            print("please update to latest firmware")
      
      

      0223a1f7-7f8c-451a-a878-1341897e78f4-image.png

      1 Reply Last reply Reply Quote 0
      • I
        iorex
        last edited by

        I also tried the example app at:
        https://uiflow-micropython.readthedocs.io/en/develop/units/roller485.html
        (see roller485_485_fire_example.m5f2 : https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/roller485/roller485_485_fire_example.m5f2)

        but it errors out:

        E (10676) i2c: i2c driver install error
        Traceback (most recent call last):
        File "<stdin>", line 67, in <module>
        File "<stdin>", line 43, in setup
        File "unit/roller485.py", line 127, in get_motor_mode
        TypeError: 'NoneType' object isn't subscriptable

        It appears that the i2c error is benign.

        Your help is appreciated.
        Iorex

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