-
Notifications
You must be signed in to change notification settings - Fork 1k
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
ST7920: SW SPI does not work, 2ND HW SPI requested #767
Comments
yes, can be done, but this is probably a bigger effort. I would need some time for this. Todo: I am confused, that the SW SPI interface doesn't work (is this related to #749) --> needs to be checked. |
Hello, it would be nice if you can do this, thank you very much Best regards |
The new constructor includes 2ND: All new constructors are listed here: |
I have created beta release 2.25.2 You can download the latest U8g2 beta release from here: https://github.com/olikraus/U8g2_Arduino/archive/master.zip
|
Hello, Best regards |
which constructor did you use? How does it look like? |
#define displ_cs PA4 |
From my perspective it is difficult why this doesn't work. There could be several reasons. One important point is this: Your board files must define SPI_INTERFACES_COUNT (see here for example the mkrzero: https://github.com/arduino/ArduinoCore-samd/blob/master/variants/mkrzero/variant.h#L91). |
The variant.h is a little bit smaller then the sample above: #ifndef VARIANT_ARDUINO_STM32 #define digitalPinToPort(P) ( PIN_MAP[P].gpio_device ) #define portSetRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BSRR) ) #define portConfigRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->CRL) ) static const uint8_t SS = BOARD_SPI1_NSS_PIN; #endif /* VARIANT_ARDUINO_STM32 */ So it wouldn't work for me |
Hmm... Guess, this needs to be requested from the STM32 Arduino people |
So I found another possibility, in version 4.5 of the platform "ST STM32" there was a function to change the SPI interface. With SPI.setModule(2); I could change the interface to SPI 2 and then then constructor |
I have the very same problem using an ST7920 and MCP41010. ST7920 alone is ok, MCPs alone is ok too, but both results is one of them not working at all. See #794 Edit: I just closed #794 , beta 2.25.2 works just fine, using this constructor: U8G2_ST7920_128X64_2_HW_SPI u8g2(U8G2_R0, 30, U8X8_PIN_NONE); Thanks a lots @elmarfaber for bringing up the issue and to @olikraus for the quick response. Without it I would have faces a lots of issues and certainly would have to source another display for my project. Kudos!! |
:) |
Thanks. Please update the page linked to by the library example "hello world" program, which gives this link in a comment for choosing the constructor:
The ST7920 does not seem to be on that list so it's taken me a while to find the correct information. |
Not clear what you mean...
Which example do you mean? There are many...
Yes, u8x8 is not available for ST7920 |
Okay. I guess there must be more than one library, and I have installed the wrong one, in that case. I'm still baffled, but I'm sure I'll work it out eventually. |
Hardware and Software communication has a big performance difference on ST7920 chip and LCD ? |
yes |
I've created my own XBM icons for segment digits. It looks like it shows a bit slow via SW mode. But I could not make it work via HW interface. That's my constructor. How can I make it work ? (I'm using SPI2) |
Which board do you use? It does not look like an Arduino Environment. |
I use STM32F103C8T6 and STM32CubeIDE. So please give me a sample about it. |
U8g2 is a Arduino Lib. I do not know these environments and I do not know your controller. I also do not know u8g2_gpio_and_delay_stm32. Maybe approach the person who wrote this. Or write your own code. |
Arduino users are mostly beginner level of hardware and software programmers. STMCube or Keil users are more professional. You have a very good library for LCD. And if you can make it work in these platforms then your library users will grow up much faster. Your library will be like a brand for LCD displays. So my advice is you focus on that. These are my thoughts :) |
Then you should be able to follow the instructions from here and implement a callback function for your uC.
Thanks
This is a spare time lib with exactly zero commercial interest. Do you really think I am interested in any growth?
:-D The good thing about a complete private, nc, open source project is: I can ignore advices. You have all the sources and instructions here. Please go ahead and implement the HW SPI callback. Let me know if you have any specific questions. I am usually always there to help (although i have to spent my personal spare time for this) |
Dear Olikraus, thank you for this great library! I have a bluepill STM32F103C8T6 and I would like to use a ST7920 display on the SPI2 (pins PB12 to PB15). On the SPI1 I have another sensor. I used the SW constructor on those pins and it works fine but slow. Unfortunately, because my project is interactive I can't use it with this speed. I am using the official Arduino_Core_STM32. The constructor for the second SPI would be
by the documentation in their wiki. I tried the HW version:
and it compiles but nothing is shown on the screen. So I tried defining
So I openned the I have sill a lot to learn so I have no ideas how to solve this... Is it really a problem with the core I am using that don't follow the Arduino standard? Do you have any suggestions for a workaround? |
I just received and tried the STM32F401CCU (Black Pill) and have exactly the same behaviour. |
Two devices could share the same SPI port of the CS line is different. Maybe you could use SPI1? |
is it possible to use the second SPI interface for the ST7920? Combined with the mySensors library I can't use the first SPI. The u8g2lib with the STM32F103C8T6 and first hardware SPI without mySensor library works very good, the software spi doesn't work for me I don't know why.
Best regards
Elmar Faber
Originally posted by @elmarfaber in #244 (comment)
The text was updated successfully, but these errors were encountered: