Skip to content
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

issue with SSD1309 - bad CS management #12

Open
eehsx opened this issue Mar 1, 2024 · 0 comments
Open

issue with SSD1309 - bad CS management #12

eehsx opened this issue Mar 1, 2024 · 0 comments

Comments

@eehsx
Copy link

eehsx commented Mar 1, 2024

Thanks Markus for your files.

SSD1309 needs "U8X8_CA(c0,a0)" command that generates this sequence : CS low, DC low, send 1 byte C0, send 1 byte A0, CS high

Your design includes CS management by spi ESP IDF :
spi_device_interface_config_t dev_config;
...
dev_config.spics_io_num = u8g2_esp32_hal.bus.spi.cs;

So, I get : DC low, CS low, send 1 byte C0, CS high, CS low, send 1 byte A0, CS high. And it's not working.

So I removed CS management by spi ESP IDF driver : dev_config.spics_io_num = U8G2_ESP32_HAL_UNDEFINED;
Then I add to u8g2_esp32_spi_byte_cb function :

case U8X8_MSG_CAD_START_TRANSFER:
	if (u8g2_esp32_hal.bus.spi.cs != U8G2_ESP32_HAL_UNDEFINED) {
		gpio_set_level(u8g2_esp32_hal.bus.spi.cs, 0);
	}
	//ESP_LOGI(TAG, "U8X8_MSG_CAD_START_TRANSFER done.");
	break;

case U8X8_MSG_CAD_END_TRANSFER:
	if (u8g2_esp32_hal.bus.spi.cs != U8G2_ESP32_HAL_UNDEFINED) {
		gpio_set_level(u8g2_esp32_hal.bus.spi.cs, 1);
	}
	//ESP_LOGI(TAG, "U8X8_MSG_CAD_END_TRANSFER done.");
	break;

So now, CS is controled by u8g2 driver and it works.

I hope this can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant