Zephyr 101 - GPIOs and PWM

Поділитися
Вставка
  • Опубліковано 29 вер 2024

КОМЕНТАРІ • 23

  • @ajm7745
    @ajm7745 11 днів тому

    is it possible to change the default led on a raspberry pico as pwm led and assign it to any other gpio pins .
    default led is at gpio 25 but the device tree for pwm_led is this :
    / {
    leds {
    compatible = "gpio-leds";
    led0: led_0 {
    gpios = ;
    label = "LED";
    };
    };
    pwm_leds {
    compatible = "pwm-leds";
    status = "okay";
    pwm_led0: pwm_led_0 {
    pwms = ;
    label = "PWM_LED";
    };
    };
    aliases {
    led0 = &led0;
    pwm-led0 = &pwm_led0;
    };
    };

  • @blobglo
    @blobglo 6 місяців тому +1

    I think the API has been changed sometime after this video, because pwm_pin_set_usec results in a "undefined reference to `pwm_pin_set_usec'" error during compilation.

    • @CircuitDojo
      @CircuitDojo  4 місяці тому

      Zephyr is a moving target. The latest documentation for PWM usage can be found here: docs.zephyrproject.org/latest/hardware/peripherals/pwm.html

  • @muhammadhaziq1255
    @muhammadhaziq1255 4 місяці тому +1

    It's been 6 months I've been working with zephyrOS. And now I think why they make embedded development difficult in zephyrOS.
    I still struggle to use gpio for simple led toggling. Adding a node in DTS and when tried to get this node. It's not there. Device pointer is null. And still unable why it is this when i have added a node in dts, the device pointer should not be a null pointer

    • @muhammadhaziq1255
      @muhammadhaziq1255 4 місяці тому +1

      It's only benefit is that we don't have to write same program from start for other some other controller. I can't think of it's other possible purpose

    • @CircuitDojo
      @CircuitDojo  4 місяці тому

      All points well taken! It’s a ton easier now with the device_dt API compared to the past. I do feel your pain though!

  • @larssolvsten
    @larssolvsten 2 роки тому +2

    Take for the very good Zephyr tutorial. A question about GPIO. How to set up a GPIO Parallel BUS.
    BEST REGARDS.
    Lars Sølvsten.

    • @CircuitDojo
      @CircuitDojo  2 роки тому

      Hi Lars, good question! Let me see if there are any provisions in Zephyr to set up a parallel bus.

  • @androbi4550
    @androbi4550 2 роки тому +2

    With your help I'll finally wrap my head around Zephyr. For buttons and leds I can highly recommend the dk_buttons_and_leds library from Nordic. Easy to use, "dynamic" number of buttons and leds and nice handling for long press events. Zephyr also has an abstraction for gpio-leds and pwm-leds with the led driver (led_on(), led_off(), led_set_brightness() which help a bit using leds.

    • @CircuitDojo
      @CircuitDojo  2 роки тому +1

      Awesome thanks for the tips and for tuning in @Androbi

  • @Deepak9aagri
    @Deepak9aagri 2 роки тому +1

    Could you please make a video for nRF9160 Feather to enable UART2 in existing samples application .. Ex: LWM2M_Client

  • @MrGoranF
    @MrGoranF Рік тому +1

    Thanks for an excellent video!! What if I want to enable an interrupt on a pin which is not in the Device Tree. I am using a nRF52840 Dongle and wants to have sensor input on eg. gpio1 pin 13 which is not a button pin. Can I do that and can you refer me to somewhere I can see a sample?

    • @CircuitDojo
      @CircuitDojo  Рік тому

      You can create a new button like this in a device tree overlay.
      / {
      buttons {
      newbutton0: new_button_0 {
      gpios = ;
      label = "Switch 2";
      };
      };
      };

  • @robvanschelven902
    @robvanschelven902 Рік тому +1

    Thanks for your great video! Related to PWM, Does Zephyr automatically selects a timer from the microcontroler to generate a PWM signal? STM32H7xx has a lot of timers, so its not clear how one and another works.

    • @CircuitDojo
      @CircuitDojo  Рік тому

      Hey Rob
      Good question!
      Generally, if you don't have a specific PWM peripheral, then you'll need to associate the timer with a PWM instance.
      &timers2 {
      status = "okay";
      pwm2: pwm {
      status = "okay";
      pinctrl-0 = ;
      pinctrl-names = "default";
      };
      };
      That's an example from stm32l496g_disco.dts within the Zephyr repo.
      Hope that helps!

    • @CircuitDojo
      @CircuitDojo  Рік тому +1

      Hey Rob,
      I dove into your question a bit more on today's live stream. Hope that helps further. :) ua-cam.com/video/TijlHi9q4tQ/v-deo.html

  • @ntn888
    @ntn888 Рік тому

    the sample blinky shipped with zephyr uses "gpio_dt_spec" function instead to grab the pointer from the device tree...

    • @CircuitDojo
      @CircuitDojo  Рік тому +2

      It didn't always! Things change in the course of a year+. In this case it was changed to use the dt calls back in December: github.com/zephyrproject-rtos/zephyr/commits/main/samples/basic/blinky/src/main.c

  • @paulcardno
    @paulcardno 2 роки тому

    Thanks foe video, getting my head around zephyr. As you say a mental shift to understand the added abstractions but looks like it gives more flexibility in what can be done and switching boards. Great video :)

  • @ThePwaifya
    @ThePwaifya 2 роки тому

    Could you make a video setting up I2C on nRF9160 Feather?