Code Monkey home page Code Monkey logo

Comments (3)

nopnop2002 avatar nopnop2002 commented on June 5, 2024

I don't know how to use SPI without DMA.

You can probably find out by asking here.

https://github.com/espressif/esp-idf/issues

from esp-idf-ili9340.

AliMoal avatar AliMoal commented on June 5, 2024

I guess, it is because we cannot use SPI without DMA for transferring more than 64 Bytes in one session according to the docs.
I'll change it and figure out how to fix this.

from esp-idf-ili9340.

AliMoal avatar AliMoal commented on June 5, 2024

I rewrote transfer function to this and fixed it.

bool spi_master_write_byte(spi_device_handle_t SPIHandle, const uint8_t* Data, size_t DataLength)
{
	spi_transaction_t SPITransaction;
	esp_err_t ret;

// 	if ( DataLength > 0 ) {
// 		memset( &SPITransaction, 0, sizeof( spi_transaction_t ) );
// 		SPITransaction.length = DataLength * 8;
// 		SPITransaction.tx_buffer = Data;
// #if 1
// 		ret = spi_device_transmit( SPIHandle, &SPITransaction );
// #endif
// #if 0
// 		ret = spi_device_polling_transmit( SPIHandle, &SPITransaction );
// #endif
// 		assert(ret==ESP_OK); 
// 	}

	if ( DataLength > 0 ) {
		memset( &SPITransaction, 0, sizeof( spi_transaction_t ) );
		uint32_t Count = 0;
		for (; DataLength / SOC_SPI_MAXIMUM_BUFFER_SIZE != 0; Count++, DataLength -= SOC_SPI_MAXIMUM_BUFFER_SIZE)
		{
			SPITransaction.length = SOC_SPI_MAXIMUM_BUFFER_SIZE * 8;
			SPITransaction.tx_buffer = &Data[Count * SOC_SPI_MAXIMUM_BUFFER_SIZE];
			ret = spi_device_transmit( SPIHandle, &SPITransaction );
			assert(ret==ESP_OK); 
		}
		if (DataLength % SOC_SPI_MAXIMUM_BUFFER_SIZE != 0)
		{
			SPITransaction.length = (DataLength % SOC_SPI_MAXIMUM_BUFFER_SIZE) * 8;
			SPITransaction.tx_buffer = &Data[Count * SOC_SPI_MAXIMUM_BUFFER_SIZE];
			ret = spi_device_transmit( SPIHandle, &SPITransaction );
			assert(ret==ESP_OK); 
		}
	}

	return true;
}

from esp-idf-ili9340.

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.