Forum: Mikrocontroller und Digitale Elektronik ESP32 GPIO 1V@LOW


von Welle 🧐 S. (w3llschmidt)


Lesenswert?

Hallo,

ich habe mal wieder ein Streit mit einem ESP32. Der ESP liegt hier nackt 
in einem Brennermodul.

Mit diesem Code hier (Auszug)
1
#ifndef MCPWM_H // Header wrapper
2
#define MCPWM_H // Header wrapper
3
4
  #define GPIO_PWM0A_OUT  5  
5
  #define GPIO_INA1_OUT   18  
6
  #define GPIO_INA2_OUT   19    
7
  #define GPIO_FAULT0_IN  17  
8
9
  #include "driver/mcpwm.h"
10
  #include "soc/mcpwm_reg.h"
11
  #include "soc/mcpwm_struct.h"
12
13
  //PWM initialisieren
14
  void pwm_init();
15
16
  //Drive the motor
17
  void brushed_motor_forward(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num , float duty_cycle);
18
  void brushed_motor_backward(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num , float duty_cycle);
19
  void brushed_motor_coast(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num);
20
  void brushed_motor_hard_stop(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num);
21
22
#endif // MCPWM_H // Header wrapper
1
#include "esp_log.h"
2
3
#include "driver/mcpwm.h"
4
#include "soc/mcpwm_reg.h"
5
#include "soc/mcpwm_struct.h"
6
7
#include <pwm.h>
8
9
#define GPIO_OUTPUT_PIN_SEL  ((1ULL<<GPIO_INA1_OUT) | (1ULL<<GPIO_INA2_OUT))
10
11
static const char *TAG = "mcpwm";
12
13
void gpio_initialize() {
14
    mcpwm_gpio_init(MCPWM_UNIT_0, MCPWM0A, GPIO_PWM0A_OUT);
15
    mcpwm_gpio_init(MCPWM_UNIT_0, MCPWM0B, GPIO_PWM0B_OUT);
16
17
    mcpwm_gpio_init(MCPWM_UNIT_0, MCPWM_FAULT_0, GPIO_FAULT0_IN);   
18
    mcpwm_gpio_init(MCPWM_UNIT_0, MCPWM_FAULT_1, GPIO_FAULT1_IN);
19
20
    gpio_config_t io_conf;
21
    //disable interrupt
22
    io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
23
    //set as output mode
24
    io_conf.mode = GPIO_MODE_OUTPUT;
25
    //bit mask of the pins that you want to set,e.g.GPIO18/19
26
    io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL  ;
27
    //disable pull-down mode
28
    io_conf.pull_down_en = 1;
29
    //disable pull-up mode
30
    io_conf.pull_up_en = 0;
31
    //configure GPIO with the given settings
32
    gpio_config(&io_conf);
33
34
}

Messe ich 0,9V an GPIO18, was natürlich nicht für ein LOW reicht.
Ich habe keine Idee wer/was das macht. Kann das mit dem PWM 
zusammenhängen?

Schaltungsproblem ist ausgeschlossen. Mit Code hier liegen am GPIO18
NULL Volt an:
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <string.h>
4
5
#include <freertos/FreeRTOS.h>
6
#include <freertos/task.h>  
7
8
#include <driver/gpio.h>
9
10
11
#define GPIO_INA1_OUT 18
12
#define GPIO_INA2_OUT 19
13
14
#define GPIO_OUTPUT_PIN_SEL  ((1ULL<<GPIO_INA1_OUT) | (1ULL<<GPIO_INA2_OUT))
15
16
void app_main() {
17
18
  gpio_config_t io_conf;
19
  //disable interrupt
20
  io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
21
  //set as output mode
22
  io_conf.mode = GPIO_MODE_OUTPUT;
23
  //bit mask of the pins that you want to set,e.g.GPIO18/19
24
  io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL  ;
25
  //disable pull-down mode
26
  io_conf.pull_down_en = 1;
27
  //disable pull-up mode
28
  io_conf.pull_up_en = 0;
29
  //configure GPIO with the given settings
30
  gpio_config(&io_conf);
31
32
}

???

: Bearbeitet durch User
von Wolfgang (Gast)


Lesenswert?

W3ll S. schrieb:
> Messe ich 0,9V an GPIO18, was natürlich nicht für ein LOW reicht.
> Ich habe keine Idee wer/was das macht. Kann das mit dem PWM
> zusammenhängen?

Was hast du denn gemessen, wenn du sagst: "Messe ich 0,9V"?
Ist das ein Momentanwert oder ein Mittelwert?

von Welle 🧐 S. (w3llschmidt)


Lesenswert?

Hallo Wolfgang, ein Momentanwert.

Der GPIO19 verhält sich normal (3,25V|0V).

Der GPIO18 macht (2,73V|1V) :-o ????

: Bearbeitet durch User
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.