-
-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for the latest Arduino-Pico #619
Comments
hi, thanks for your feedback 👍 are you positive you used the develop branch? this is the exact same code bool lgfx_gpio_set_function(int_fast16_t pin, gpio_function_t fn)
{
if (pin < 0 || pin >= static_cast<int_fast16_t>(NUM_BANK0_GPIOS))
{
return false;
}
if ((((uint32_t)fn << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB) & ~IO_BANK0_GPIO0_CTRL_FUNCSEL_BITS) != 0)
{
return false;
}
uint32_t temp = padsbank0_hw->io[pin];
temp &= ~(PADS_BANK0_GPIO0_IE_BITS | PADS_BANK0_GPIO0_OD_BITS);
temp |= PADS_BANK0_GPIO0_IE_BITS;
padsbank0_hw->io[pin] = temp;
volatile io_bank0_hw_t *iobank0_regs = reinterpret_cast<volatile io_bank0_hw_t *>(IO_BANK0_BASE);
iobank0_regs->io[pin].ctrl = fn << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB;
return true;
} |
Tested by adding the following code to the end of lgfx_gpio_set_function() in the develop branch.
The fixes in the develop branch resolve the build errors, but the pin configuration doesn't seem to work correctly, and the screen remains black. |
thanks for clarifying, I missed that important detail 🤦 #if !PICO_RP2040
the recommended usage is to use positive matching: #if defined(PICO_RP2350)
// Remove pad isolation now that the correct peripheral is in control of the pad
hw_clear_bits(&padsbank0_hw->io[pin], PADS_BANK0_GPIO0_ISO_BITS);
#endif
could it be that more functions (e.g. |
I am looking for potential fixes by referencing the differences between Pico SDK 2.0.0 and 1.5.1.
Since gpio_set_pulls() does not contain any RP2350-specific code, it seems that lgfx_gpio_set_pulls() does not require RP2350-specific code either. In gpio.c, it seems that the only function containing RP2350-specific code is gpio_set_function. At the very least, the following code started working as expected after making modifications to lgfx_gpio_set_function(). |
if the issue isn't in the gpio layer, then maybe it's in spi layer adding a DEBUG build flag to the platformio.ini will enable the DBGPRINT macro [env:rpipico2]
board = rpipico2
build_flags = -DDEBUG it may be necessary to add more DBGPRINT() statements in common.cpp and Bus_SPI.cpp e.g. to trace the init and compare between rp2040 and rp2350 |
Thank you for teaching me how to debug!!
I kind of understand what you're getting at. For example, DBGPRINT in lgfx_spi_init().
|
I believe DebugUtil.hpp contained something like this: #define DBG_ENTER() printf("\n")
#define DBGPRINT printf
#define DBGPRINTFUNC(fmt, ...) printf("%s(): " fmt, __func__, ##__VA_ARGS__)
enabling debug will print so much data that differences in the values will be hard to spot, some debug statements will need to be commented out to prevent that. a more simple test is to check if the init/setup works similarly between rp2040 and rp2350, for this you can simply add some debug messages at specific places e.g. add more functions where debug statements can be added:
|
Thank you. I managed to get the debug output working for now. Inserted DBGPRINTFUNC and tested it on both RP2040 and RP2350.
Thank you for merging the RP2350 fixes into the develop branch. |
btw I see that your picoLGFX project has two configs, are you experiencing the same black screen problem with Panel_GC9A01? other observation: Panel_SSD1306 has
maybe RP2040 somehow automatically corrects the bus speed, but RP2350 doesn't? it could be interesting to see how RP2040 and RP2350 behave when |
I also tested with the GC9A01, but both the Pico and Pico2 remain with a black screen, and no text is displayed. |
please see this recent pull request where the pins map was updated for RP2350, it's also very insightful for the pins choice |
Issue resolved, thank you! The cause was a wiring mistake. Successfully displayed text on both Pico and Pico2 screens. |
Thank you very much for all the advice! |
Hello,
I am trying to display text on an SSD1306 using a Raspberry Pi Pico2.
I used the code from the develop branch, but it didn’t work properly.
But, It worked correctly after applying similar modifications to lgfx_gpio_set_function() as in gpio_set_function() in Pico SDK 2.0.0.
The changes have been pushed to the forked stdev branch, and I hope they will be helpful for supporting the latest Arduino-Pico.
https://github.com/stonedev-app/LovyanGFX.git
The text was updated successfully, but these errors were encountered: