Very slow SPI on ESP32? #7398
Replies: 1 comment
-
Posted at 2018-05-29 by @gfwilliams I believe the ESP8266/ESP32 hardware SPI code isn't that speedy in general. Espruino expects to be able to queue a byte to send, then go away and work out the next byte while the first is sending. The ESPxx API doesn't let it do that so it has to send a byte, pause while it works out the next one, and so on. You could try software SPI? Not sure if that'll be faster, but it might be as it runs as fast as it can - especially if you don't specify a MISO pin, because you don't actually care about receiving data. Posted at 2018-05-29 by ConorONeill Thanks Gordon, I'll give that a try later. Posted at 2018-05-30 by ConorONeill About twice as fast in software. Bummer about the hardware speed.
Posted at 2018-05-30 by Wilberforce The esp32 esp-idf allows a string to be sent - can you think of a way of keeping the existing code and also using the output as a string ? I suppose it could be done with the #ifdef but wondering if there is a cleaner way? Posted at 2018-05-30 by @gfwilliams There's no easy way - in some cases the SPI could be sent a buffer, but for what the ILI9341 driver is doing here (sending a block of the same color) it's not going to work. Neither would it work for a bunch of other stuff. Basically we'd end up doing a massive hack and then maybe the ILI9341 would be twice as fast - but still too slow to be useful. Personally I'd like to sort out SPI properly so that it could work with buffers and DMA. That'd massively improve performance on all platforms. Posted at 2019-01-11 by barbiani I have just found out how slow it really is :( Posted at 2019-01-23 by hungryforcodes Yeah I'm using it as well for a project and while the software SPI trick certainly sped it up (I was using hardware SPI), its still pretty glacial. Interestingly, here is a guy who's got a number of games, including DOOM, running on an ESP32 and an ILI9341. https://hackaday.io/project/163464-gaming-on-the-esp32-odroid-go Its PRETTY fast. So there is potential.... Posted at 2019-01-24 by Wilberforce The issue is that the library esp provides takes a buffer - and the espruino calls send one byte at a time - so it's taking a buffer, and sending it a single byte - so it's really inefficient. Posted at 2019-01-24 by hungryforcodes Oh I see. Thanks for the explanation! :) Posted at 2019-01-24 by @gfwilliams There are some issues filed for it already:
Basically rather than just hacking something in I'd like to get this fixed properly in a way that really improves all boards. Posted at 2019-01-25 by hungryforcodes Thanks for the links Gordon, I checked them out, and you're right -- that for sure is the right approach. In my case I'm using it with something called the M5 Stack ( https://m5stack.com ), and thats a pretty neat little box, with lots of stackable options. Its totally usable as is, just not for making games or say, realtime UIs. Also, I know Jumjum and Wilberforce are working hard on the current challenges of integrating the latest versions of the ESP IDF.. . :) Posted at 2019-04-23 by urish I'd also love to see faster hardware SPI in Espruino Posted at 2020-03-22 by @MaBecker has anyone checked this spi example? https://github.com/loboris/ESP32_NEW_SPI_MASTER_EXAMPLE/tree/master/main |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-05-29 by ConorONeill
I'm playing around with one of the TTGO boards. It has an ILI9341 screen. But it looks like SPI is running at an extremely low rate. It takes several seconds just to clear the screen.
I found an old thread that mentioned ESP32 defaulting to 100kbs and ignoring the baud setting. Is that still true? Any way around it? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions