Modbus sample errors- cdc acm

Hi, 

i want to use modbus RTU server sample, ive done everything just like in guide, used proper devicetree, commented line in overlay etc. Downloaded pymodbus with the plugin to have a console working with just commands. And this is what i get everytime: 


Any idea how can i repair it? I want to use sample in my own code, but i cant get it working. Ofc ive changed command to start terminal with ttyACM0. 

Parents
  • Hi

    Which version of NCS are you using? 

    Could you show me your build configuration? 

    Do you have any warnings in your build log? 

    Regards

    Runar

  • v2.6.1, west worskpace v2.5.2

    (Im inside modbus rtu server folder)

    nrfutil toolchain-manager launch --shell
    west build -b nrf52840dk_nrf52840 -- -DDTC_OVERLAY_FILE=cdc-acm.overlay -DEXTRA_CONF_FILE=overlay-cdc-acm.conf
    west flash

    Initializing shell environment!
    
    bash-5.1$ west build -b nrf52840dk_nrf52840 -- -DDTC_OVERLAY_FILE=cdc-acm.overlay -DEXTRA_CONF_FILE=overlay-cdc-acm.conf
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: /home/hubert/ncs/zephyr/samples/subsys/modbus/rtu_server
    -- CMake version: 3.21.0
    -- Found Python3: /home/hubert/ncs/toolchains/2be090971e/usr/local/bin/python3.9 (found suitable version "3.9.18", minimum required is "3.8") found components: Interpreter 
    -- Cache files will be written to: /home/hubert/.cache/zephyr
    -- Zephyr version: 3.4.99 (/home/hubert/ncs/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf52840dk_nrf52840
    -- Found host-tools: zephyr 0.16.5 (/home/hubert/ncs/toolchains/2be090971e/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (/home/hubert/ncs/toolchains/2be090971e/opt/zephyr-sdk)
    -- Found BOARD.dts: /home/hubert/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Found devicetree overlay: cdc-acm.overlay
    -- Found devicetree overlay: cdc-acm.overlay
    -- Generated zephyr.dts: /home/hubert/ncs/zephyr/samples/subsys/modbus/rtu_server/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /home/hubert/ncs/zephyr/samples/subsys/modbus/rtu_server/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /home/hubert/ncs/zephyr/samples/subsys/modbus/rtu_server/build/zephyr/dts.cmake
    Parsing /home/hubert/ncs/zephyr/Kconfig
    Loaded configuration '/home/hubert/ncs/zephyr/samples/subsys/modbus/rtu_server/build/zephyr/.config'
    No change to configuration in '/home/hubert/ncs/zephyr/samples/subsys/modbus/rtu_server/build/zephyr/.config'
    No change to Kconfig header in '/home/hubert/ncs/zephyr/samples/subsys/modbus/rtu_server/build/zephyr/include/generated/autoconf.h'
    CMake Warning at /home/hubert/ncs/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
      CONFIG_USB_DEVICE_VID has default value 0x2FE3.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    CMake Warning at /home/hubert/ncs/zephyr/subsys/usb/device/CMakeLists.txt:28 (message):
      CONFIG_USB_DEVICE_PID has default value 0x100.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/hubert/ncs/zephyr/samples/subsys/modbus/rtu_server/build
    -- west build: building application
    [7/7] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       62108 B         1 MB      5.92%
                 RAM:       21196 B       256 KB      8.09%
            IDT_LIST:          0 GB         2 KB      0.00%
    bash-5.1$ 
    

  • I did change baudrate once to 115200 in both example and pymodbus terminal and it didnt work. Ill try to disable mass storage device, but i have a question. What do you mean with corresponding toolchain, im using 2.6.1 according to VSC and nrfutill shell 

  • runsiv said:
    v2.6.1, west worskpace v2.5.2

    If you are using toolchain 2.6.1 then everything is fine. 

    I'm not sure what the issue is, but I'm asking internally to see if anyone has experience with it. It might be there are people more familiar with modbus on the zephyr discord so it would not hurt to ask there also. 

    Regards

    Runar

  • Its not error with modbus actually, there is a problem with USB CDC ACM, i tried to use cdc acm sample and it also doesnt work in the same way *** Booting nRF Connect SDK v2.5.2 ***
    [00:00:00.251,953] <inf> cdc_acm_echo: Wait for DTR

  • As we now know from the discord chat. Wrong usb port. I totally forgot about that one. 

    So in short: the nrf52840 has two usb ports, for the sample to work remember to connect to the usbport next to the buttons. 

    Regards

    Runar

Reply Children
No Data
Related