I am trying to implement a UART communication using Raspberry Pi Pico (RP2040) board. I have run some demo codes which is provided in https://github.com/raspberrypi/pico-examples.
I was able to establish UART communication.
#include <stdio.h>
#include "pico/stdlib.h"
#include <string.h>
#include "pico/bootrom.h"
const uint LED_PIN = PICO_DEFAULT_LED_PIN;
int main() {
stdio_init_all();
char buffer[1024];
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
char name[25];
while(1){
printf("b - blink the LED\nr - reboot the Pico\n");
scanf("%1024s",buffer);
printf("%s\n",buffer);
if(strcmp(buffer,"b")==0)
{
int i = 0;
while(i<10)
{
i++;
gpio_put(LED_PIN,1);
sleep_ms(250);
gpio_put(LED_PIN,0);
sleep_ms(250);
}
}
else if(strcmp(buffer, "r") == 0)
{
reset_usb_boot(0,0);
}
}
return 0;
}
This is the code that I am trying to run now, where LED should blink or boot according to the character entered. It was working fine but suddenly I had an issue where minicom couldn't find the port ttyACM0 and was not displaying any port while running dmesg command.
I have fixed it but now minicom screen is displaying,
Welcome to minicom 2.8
OPTIONS: I18n
Port /dev/ttyACM0, 14:39:20
Press CTRL-A Z for help on special keys
but it's not reading any character and even if I enter character 'b' to blink LED it takes more than 10 minutes to display and again some minutes to blink the LED. So its getting difficult to test any other code.
Please help me I have searched every possible sites but didn't got any solution and some solutions I tried was not working (like changing Hardware flow to No,Checking my port by connecting and disconnecting USB to ensure whether I have given right port etc...).
Any suggestions will be appreciated and Thanks in advance.