错误:'__device_dts_ord_DT_N_ALIAS_stepper'此处未声明(不在函数中)

问题描述 投票:0回答:1

我正在 zephyr RTOS 中为 stm32 nulceo h7a3zi_q 编写代码,以控制 3 个步进电机。现在我在进行 west build 时遇到以下错误:

error: '__device_dts_ord_DT_N_ALIAS_stepper' undeclared here (not in a function)

这是定义步进器的覆盖文件的一部分:

    aliases {
            debug-uart = &usart2;
            mother-uart = &usart6;
            stepper-motor1 = &stepper_motor_1; 
            stepper-motor2 = &stepper_motor_2; 
            stepper-motor3 = &stepper_motor_3; 
    };
   

    steppermotors { 
        compatible = "stepper-motors"; 
        stepper_motor_1: motor_1 { 
            label = "First link"; 
            dir-gpios = <&gpioa 3 GPIO_ACTIVE_LOW>; //A0
            step-gpios = <&gpioc 0 GPIO_ACTIVE_LOW>; //A1
        };
    
        stepper_motor_2: motor_2 {
            label = "Second Link"; 
            dir-gpios = <&gpioc 3 GPIO_ACTIVE_LOW>; //A2
            step-gpios = <&gpiob 1 GPIO_ACTIVE_LOW>; //A3
        };
    
        stepper_motor_3: motor_3 { 
            label = "Turn Table";
            dir-gpios = <&gpioc 2 GPIO_ACTIVE_LOW>; //A4
            step-gpios = <&gpiof 7 GPIO_ACTIVE_LOW>; //A5
        };
    };
};

步进电机节点使用的绑定:

description: Stepper motors driven by TB6600 (parent node)

compatible: "stepper-motors"

child-binding:
  description: GPIO-driven dc motor (child node)
  properties:
    dir-gpios:
      required: true
      type: phandle-array
      description: |
        Dir pin for the motor

    step-gpios:
      required: true
      type: phandle-array
      description: |
        Step pin for the motor

    label:
      type: string
      description: |
        Human readable string describing the motor.

这是 prj.conf :

CONFIG_GPIO=y
CONFIG_PRINTK=y
CONFIG_LOG=y
CONFIG_LOG_PRINTK=y
CONFIG_SERIAL=y
CONFIG_I2C=y
CONFIG_SENSOR=y
CONFIG_MPU6050=y
CONFIG_MPU6050_TRIGGER_NONE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_PWM=y
CONFIG_CRC=y
CONFIG_USB_CDC_ACM=y
CONFIG_KYVERNITIS=y
CONFIG_CANSCRIBE=y
CONFIG_CANARD=y
CONFIG_Tarzan=y

CONFIG_CBPRINTF_FP_SUPPORT=y
CONFIG_REBOOT=y

CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Team RUDRA Tarzan"
CONFIG_USB_DEVICE_PID=0x0004
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n

CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_LINE_CTRL=y

如何解决这个问题? 我想我缺少 prj.conf 中的一些配置。

我该如何解决这个问题,我厌倦了在 prj.conf 中添加一些额外的配置,但这也没有帮助。

nucleo zephyr-rtos stm32h7
1个回答
0
投票

我也收到同样的错误消息。

© www.soinside.com 2019 - 2024. All rights reserved.