Author Topic: ESP 32 is fa.........st  (Read 2518 times)

0 Members and 1 Guest are viewing this topic.

Offline ebclrTopic starter

  • Super Contributor
  • ***
  • Posts: 2328
  • Country: 00
ESP 32 is fa.........st
« on: February 19, 2017, 02:31:31 pm »
Quick reply without calculating

What will be signal frequency on output5, on a standard esp32 board using Arduino and espressif


void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite( 5,HIGH );
//  delay(100);
  digitalWrite( 5,LOW );
//  delay(100);
}
 

Offline cowana

  • Frequent Contributor
  • **
  • Posts: 324
  • Country: gb
Re: ESP 32 is fa.........st
« Reply #1 on: February 19, 2017, 02:48:19 pm »
No idea!

But if a 16MHz ATMEGA328 manages about 200kHz with the bloat of digitalWrite, I'd expect somewhere around 3MHz from an ESP32 running at 240MHz?
 

Offline ebclrTopic starter

  • Super Contributor
  • ***
  • Posts: 2328
  • Country: 00
Re: ESP 32 is fa.........st
« Reply #2 on: February 19, 2017, 02:50:00 pm »
Amazing 3.65 Mhz
 

Offline daybyter

  • Frequent Contributor
  • **
  • Posts: 397
  • Country: de
Re: ESP 32 is fa.........st
« Reply #3 on: February 19, 2017, 09:50:08 pm »
How fast is analogRead ?
 

Offline Bruce Abbott

  • Frequent Contributor
  • **
  • Posts: 627
  • Country: nz
    • Bruce Abbott's R/C Models and Electronics
Re: ESP 32 is fa.........st
« Reply #4 on: February 20, 2017, 12:33:57 am »
if a 16MHz ATMEGA328 manages about 200kHz with the bloat of digitalWrite,
Or, without the bloat...
Code: [Select]
.include "m328def.inc"
 ldi  r16,1<<5
 out  DDRB,r16
loop:
 out  PINB,R16
 rjmp loop
2.67MHz (3.33MHz @20MHz)
 
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3025
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: ESP 32 is fa.........st
« Reply #5 on: February 20, 2017, 01:40:29 am »
It's no secret that the pin operations in the Arduino main core are very bloated and slow.

Frustratingly it would be possible to refactor the functions (pinMode, digitalWrite, digitalRead...) a bit and use some GCC compile-time magic to make serious optimisation for constant (compile time known) arguments such that a digitalWrite or pinMode for example would be optimised down to a single sbi or cbi instruction, like I did for my ATTinyCore fork

But I think any such pull request on the main arduino core would probably languish in the pit of "oh but it might break [insert random thing that a developer happens to use] which was relying on the slowness".

~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf