Coder Social home page Coder Social logo

Comments (3)

willianaraujo avatar willianaraujo commented on June 13, 2024 1

I kept looking for the issue and found the root cause, but I'm not exactly sure why the problem started happening. I believe it could be due to an update in ESP-IDF or FreeRTOS, someone with more experience in embedded systems might know...

Basically, in the u8g2_esp32_spi_byte_cb() function when filling out the fields of the dev_config variable to send to the spi_bus_add_device() function, none of the documentation I found instructed to pass the dev_config.clock_source field, but from what I saw in the functions that are called from here, this information is needed.

So, the error above was caused because the dev_config.clock_source field is not being filled in the u8g2_esp32_spi_byte_cb function before passing the dev_config as a parameter in the line ESP_ERROR_CHECK(spi_bus_add_device(HSPI_HOST, &dev_config, &handle_spi));

This way the initialization for the dev_config parameter would look like this:

		  spi_device_interface_config_t dev_config;
		  dev_config.address_bits     = 0;
		  dev_config.command_bits     = 0;
		  dev_config.dummy_bits       = 0;
		  dev_config.mode             = 0;
		  dev_config.duty_cycle_pos   = 0;
		  dev_config.cs_ena_posttrans = 0;
		  dev_config.cs_ena_pretrans  = 0;
		  dev_config.clock_speed_hz   = 10000;
		  dev_config.clock_source     = SPI_CLK_SRC_DEFAULT; //SOC_MOD_CLK_APB;
		  dev_config.spics_io_num     = u8g2_esp32_hal.cs;
		  dev_config.flags            = 0;
		  dev_config.queue_size       = 200;
		  dev_config.pre_cb           = NULL;
		  dev_config.post_cb          = NULL;
		  //ESP_LOGI(TAG, "... Adding device bus.");
		  ESP_ERROR_CHECK(spi_bus_add_device(HSPI_HOST, &dev_config, &handle_spi));

That's it. Looking at the current ESP-IDF code, I can't understand how my previous code worked without this field, as browsing through previous versions of ESP-IDF on GitHub, this information was always mandatory.

I won't mark this thread as resolved since, as I mentioned, I don't understand why it worked before. Therefore, my solution might not be the correct one, or everything I said may not make sense, but as I'm behind schedule with my project, I won't delve further into this investigation.

Cheers!

from esp32-snippets.

William-Irvine avatar William-Irvine commented on June 13, 2024 1

I added the clock source and it built with logging set to none.

Was still flaky telling me the argument was invalid, so I put a 2 second delay before my call to "u8g2_Setup_st7920_128x64_f();" and now it seems to run perfectly.

I am wondering if it has to do with how fast the device is booting now, and thinking maybe its trying to set that clock source before the chip can initialize it?

Either way its interesting.

Thanks for the initial post, helped me a lot.

from esp32-snippets.

William-Irvine avatar William-Irvine commented on June 13, 2024

I have noticed this issue as well.

Using Kolban's HAL I get the same crash after updating from 4.2 to 5.1, but only when I have logging set to INFO or higher.

Otherwise I get the same crash.

Going to try the your solution now.

from esp32-snippets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.