Hello,
first, sorry, my english is not the best
I have to send a 12Bit Word parallel with a ESP32. How can i do this as fast as possible?
It i send it with digitalWrite...i think its very slow. In Arduino i can use port manipulation...i read its also possible with ESP32? The register GPIO_OUT_W1TS_REG ?
What Pins should i need? How would you send the example Word -> 0b 1101 1100 0011 ? Have anyone a example for me? The Bit Word is change continuously and i need fast and continuous timing.
Thanks!
How can i FAST send 12 Bit Words parallel with ESP32
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: How can i FAST send 12 Bit Words parallel with ESP32
Look into the parallel mode of the I2S peripheral.
Re: How can i FAST send 12 Bit Words parallel with ESP32
Thank you. I think its the right for me. But i dont know how to make it. Im looking in the reference manual and examples but i dont know how to send the data.
I have to 12 Bit Ports, so i think i can send a 24bit word at same time. Is there a example?
I have to 12 Bit Ports, so i think i can send a 24bit word at same time. Is there a example?
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: How can i FAST send 12 Bit Words parallel with ESP32
I think you can use the 16-bit mode, that's closest to the 12 bit you need. There's some other projects out there that use the parallel i2s interface (for instance, this one), maybe you can browse through their code for inspiration.
Re: How can i FAST send 12 Bit Words parallel with ESP32
Esto no te funciona lo suficientemente rápido?
- /*
- * Programa para el ESP32 que consiste en formar un puerto con varios
- * GPIOs, (ya que el ESP32 no tiene configuración por puertos paralelos
- * como en los Atmegas y PICs).
- *
- * Alfredo Segura Querétaro, México febrero de 2022
- */
- int D0 = 13; // 8 bits para salida paralela,
- int D1 = 12; // en cada PIN del ESP32
- int D2 = 14;
- int D3 = 27;
- int D4 = 26;
- int D5 = 25;
- int D6 = 33;
- int D7 = 32;
- int variable = 0;
- String datochar;
- int i = 0;
- int j = 0;
- void setup() {
- pinMode(D0, OUTPUT);
- pinMode(D1, OUTPUT);
- pinMode(D2, OUTPUT);
- pinMode(D3, OUTPUT);
- pinMode(D4, OUTPUT);
- pinMode(D5, OUTPUT);
- pinMode(D6, OUTPUT);
- pinMode(D7, OUTPUT);
- digitalWrite(D0, LOW);
- digitalWrite(D1, LOW);
- digitalWrite(D2, LOW);
- digitalWrite(D3, LOW);
- digitalWrite(D4, LOW);
- digitalWrite(D5, LOW);
- digitalWrite(D6, LOW);
- digitalWrite(D7, LOW);
- Serial.begin(115200);
- }
- void loop() {
- if (Serial.available()) {
- datochar = Serial.read();
- Serial.println(datochar);
- variable = datochar.toInt();
- digitalWrite(D0, bitRead(variable,0));
- digitalWrite(D1, bitRead(variable,1));
- digitalWrite(D2, bitRead(variable,2));
- digitalWrite(D3, bitRead(variable,3));
- digitalWrite(D4, bitRead(variable,4));
- digitalWrite(D5, bitRead(variable,5));
- digitalWrite(D6, bitRead(variable,6));
- digitalWrite(D7, bitRead(variable,7));
- }
- delay(100);
- }
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: How can i FAST send 12 Bit Words parallel with ESP32
That code is super-inefficient on any processor, so I wouldn't think so.
Re: How can i FAST send 12 Bit Words parallel with ESP32
AlfredoSC...whats this? This is really the slowest version...
I think i try to work with the https://github.com/TobleMiner/esp_i2s_parallel
Any other Ideas?
I think i try to work with the https://github.com/TobleMiner/esp_i2s_parallel
Any other Ideas?
Who is online
Users browsing this forum: No registered users and 93 guests