Closed nrhint closed 9 months ago
It looks like you should ask for help on the forum. PICO_DEFAULT_UART_TX_PIN appears to only be used for stdio as far as I can see. Your code is close but is hardcoding the gpios of course.
gpio_init(0);
gpio_init(1);
gpio_set_function(0, GPIO_FUNC_UART); //TX
gpio_set_function(1, GPIO_FUNC_UART); //RX
You need to check section "1.4.3. GPIO Functions" to know which gpios you can use for rx/tx etc.
where is the best place for documentation?
The official documentation for Pico and RP2040 can be found at https://www.raspberrypi.com/documentation/microcontrollers/
When I first read the uart I get a null char even when nothing is coming from the GPS
That may be due to #1125 (or something similar?)
And WRT adding your #define PICO_DEFAULT_UART_TX_PIN
to the C code, note that you need to do this before you #include
any files, because https://github.com/raspberrypi/pico-sdk/blob/master/src/boards/include/boards/pico.h does
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
Perfect, thanks for the help. I tracked it down to some board issues and missing documentation for the board that I was using. The pinout of the board was not matching the documentation which I discovered when looking at the schematic and I was using pins that were not uart capable.
This program should pass through uart communication from a gps module from adafruit to the computer. There are two distinct problems/bugs. When I first read the uart I get a null char even when nothing is coming from the GPS (tested by removing the uart pins from the pico) there is a null char (int 0) in the buffer. This might be normal behavior however I could not find it documented. The second problem is using other pins for uart0. I read several things online and several ways to change it. The way that I am trying right now is in the cmake file where I set the ports. This method did not work for me. I also tried to override the defined values with
#define PICO_DEFAULT_UART_TX_PIN 16 \n #define PICO_DEFAULT_UART_RX_PIN 18
which also had no effect.Here is the code that I am using:
main.cpp
CMakeLists.txt
build.sh
The device I am using is a pico-ice which also has an icefpga on the same board but I am not using any of those features. I am happy to keep trying things and providing information. I have created a copy of the project at this point and can try different things. I do not have a ton of experience here so I would not be suppurised if I am doing something wrong. Another random tack on question, where is the best place for documentation? I have looked online and found a ton of different things but many of them do not agree and have different functions and features (I assume partly from the many variants of boards that use the pico chip)
(edited by lurch to fix the formatting of the code-blocks)