Skip to content

pulseIn cause Nodemcu to reset with some pins. #1149

Closed
@Leen15

Description

@Leen15

Hi, i was trying to make working a SRF04 with my nodemcu and i notice something strange that reboot the board. So i tried to minimize my code for find the problem, and appear that pulseIn is causing the board to reset with some pins. (i don't know how).

With this code, and nothing connected to the board:

const int ECHO_PIN = D3; // WORKING WITH: D1,D2,D8 -  NOT WORKING WITH: D3,D4,D5,D6,D7,D9,D10       
void setup() {
   // initialize serial communication:
    Serial.begin(115200);       
    pinMode(ECHO_PIN,INPUT);  
}

void loop() {
  long duration;
  duration = pulseIn(ECHO_PIN,HIGH);
  Serial.println(duration);  
  delay(100);
}

I read in serial values of type 1 or 2 and the board keep running with ECHO_PIN set to D1,D2, or D8, but with pins D3,D4,D5,D6,D7,D9,D10 I receive instead something like:

1000001
1000001
1000000

ctx: cont 
sp: 3ffe9aa0 end: 3ffe9c90 offset: 01b0

>>>stack>>>
3ffe9c50:  00000000 00000000 00000016 3ffe9cbc  
3ffe9c60:  3fffdc20 00000000 3ffe9cb4 40201d90  
3ffe9c70:  00000000 00000000 00000000 402018ea  
3ffe9c80:  00000000 00000000 3ffe8c70 40100118  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16 
tail 0
chksum 0x42
csum 0x42
~ld

and it reset every 3-4 prints.

Did i miss something in the sketch? Why only 3 pins work?

PS: I tried with 3 different nodemcu boards, ESP12E.

Thanks

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions