GPIO2 manual output level very low (DEVKITC)
Posted: Thu Oct 18, 2018 10:05 pm
I'm working through the Blink example and it's finally building and loading OK I think. I just have the board alone (no breadboard) and it is powered by USB. There is no other hardware. The Blink example toggles GPIO2 every second by code. I can see the level on my oscilloscope changing about 0.2v but that is all. I thought maybe an internal pullup is needed since I have no LED on that pin. Still only 200mV. Am I configuring the pin correctly? Or must I use an external pullup even to see action on the scope?
I can use a different GPIO if #2 is not a good choice. I'm using PlatformIO in Visual Studio Code.
Code: Select all
/*
Can run 'make menuconfig' to choose the GPIO to blink, or you can edit the following line and set a number here.
*/
#define BLINK_GPIO GPIO_NUM_2 //
void blink_task(void *pvParameter)
{
/*
Configure the IOMUX register for pad BLINK_GPIO (some pads are muxed to GPIO on reset already, but some default to other
functions and need to be switched to GPIO. Consult the Technical Reference for a list of pads and their default functions.)
*/
gpio_pad_select_gpio(BLINK_GPIO);
/* Set the GPIO as a push/pull output */
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
gpio_set_pull_mode(BLINK_GPIO, GPIO_PULLUP_ONLY);
while(1)
{
/* Blink off (output low) */
gpio_set_level(BLINK_GPIO, 0);
vTaskDelay(1000 / portTICK_PERIOD_MS);
/* Blink on (output high) */
gpio_set_level(BLINK_GPIO, 1);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
//void app_main()
extern "C" void app_main(void)
{
xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
}