Any help would awesome! I’m sure this is so basic, but just can’t seem to figure it out…

We have a custom board Zephyr project using the Zephyr library’s modem Quectel BG9x drivers, but struggling to get the device tree set pins to be recognised.

We’ve set it up in the device tree

&uart3 {      
	status = "okay";
	current-speed = <115200>;
	tx-pin = <33>;
	rx-pin = <32>;
	//rts-pin = <19>;
	//cts-pin = <21>;

	quectel_bg9x {
		compatible = "quectel,bg9x";
		label = "quectel,bg9x";
		status = "okay";

		mdm-reset-gpios = <&gpio0 5 0>;
		mdm-power-gpios = <&gpio0 4 0>;
		/*ring-indicator-gpios = <&gpio0 15 0>;
		dtr-gpios = <&gpio1 0 0>;
		enable-gpios = <&gpio1 4 0>;*/
	};
};

Inside the quectel_bg9x.h header file the error happens here on the lines where the pins are configured:

// Modem pin config uses the device tree binding to set this up
static struct modem_pin modem_pins[] =  {
	/* MDM_POWER */
	MODEM_PIN(DT_INST_GPIO_LABEL(0, mdm_power_gpios),
		  DT_INST_GPIO_PIN(0, mdm_power_gpios),
		  DT_INST_GPIO_FLAGS(0, mdm_power_gpios) | GPIO_OUTPUT_LOW),

	/* MDM_RESET */
	MODEM_PIN(DT_INST_GPIO_LABEL(0, mdm_reset_gpios),
		  DT_INST_GPIO_PIN(0, mdm_reset_gpios),
		  DT_INST_GPIO_FLAGS(0, mdm_reset_gpios) | GPIO_OUTPUT_LOW),
};

And we’re getting the errors
‘DT_N_INST_0_DT_DRV_COMPAT_P_mdm_power_gpios_IDX_0_PH_P_label’ undeclared here (not in a function)
‘DT_N_INST_0_DT_DRV_COMPAT_P_mdm_power_gpios_IDX_0_VAL_pin’ undeclared here (not in a function)
‘DT_N_INST_0_DT_DRV_COMPAT_P_mdm_reset_gpios_IDX_0_PH_P_label’ undeclared here (not in a function)
‘DT_N_INST_0_DT_DRV_COMPAT_P_mdm_reset_gpios_IDX_0_VAL_pin’ undeclared here (not in a function)

Is there a device tree naming convention or something that we’re missing?

There maybe a Quectel enable flag that you need to set in your .conf. I would search for the driver you’re using and make sure it’s enabled.

Hope that helps!

Hi @jaredwolff, really appreciate your response. I enabled the driver with tcp/ip and bsd sockets in the config menu. So it’s in the project, but get the errors above the moment the header is compiled in (included in main.c)

Here’s a high level question, is there perhaps something that we’re missing in the steps we took to configure this Zephyr project configurable driver? Or a systematic way of checking what we’ve done that you would recommend?

The steps we followed to this point are:

  1. Added the modem driver and related drivers (From Zepher config menu)
  2. Added the device tree settings above (name of device to match the driver file name in an included .dts file)
  3. Added the driver header header file quectel_bg9x.h to our application

I know it’s a bit of a vague question, but I’m quite new to Zephyr and struggling to find anything that would be helpful in the docs.

Terms and Conditions | Privacy Policy