Code not working on 1 board but fine on other two

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
mc2software
Posts: 22
Joined: Wed Jan 13, 2021 6:08 pm
Location: Northern Florida

Code not working on 1 board but fine on other two

Post by mc2software » Wed Jul 07, 2021 4:25 pm

I have 3 ESP32 boards. I got it to the point where the code was doing all as expected on the breadboard, so I erased, flashed and loaded code on another ESP32 and it stopped working. I did the same on a 3rd and it worked fine. What might cause one board to not operate properly? Using v1.13 because at first I thought the problem might be related to v1.16 and wanted to stick with the original

Erase command:
esptool.py --chip esp32 --port COM3 erase_flash

Flash command:
esptool.py --chip esp32 --port COM3 write_flash -z 0x1000 esp32-idf4-20200902-v1.13.bin

Using powershell and ampy to load code (user path replaced with ... ):

Code: Select all

$defaultPort = 'COM3'
$port = $defaultPort
$folder = get-location

<#
 $port = Read-Host "Port: [$($defaultPort)]"
 if ([string]::IsNullOrWhiteSpace($port))
 {
     $port = $defaultPort
 }
 $folder = Read-Host -Prompt 'Folder to Upload'
 if ([string]::IsNullOrWhiteSpace($folder))
 {
      $folder = get-location
      Write-Host "Defaulting to current folder: "
      Write-Host $folder
}
#>

$app = 'ampy.exe'
$arg1 = '-p'
$arg2 = $port
$arg3 = 'put'

<#
	copy library files from the library folder
	update this at one point to look to higher folder and libraries folder
	this seems to fail the first time, so do it again after folder .py files
#>

$fileName = "...\OneDrive - mc2software, Inc\Development\Automation\Python Projects\libraries\mc2software.py"
$arg4 = $fileName
Write-Host "Uploading " $fileName
& $app $arg1 $arg2 $arg3 $arg4

$files = Get-ChildItem $folder -Filter *.py
foreach ($f in $files)
{
    $file = $f.FullName
    $fileName = $f.Name
    Write-Host "Uploading " $fileName
    $arg4 = $file
    & $app $arg1 $arg2 $arg3 $arg4
}

<#
	copy library files from the library folder
	this seems to fail the first time, so do it again
#>

$fileName = "...\OneDrive - mc2software, Inc\Development\Automation\Python Projects\libraries\mc2software.py"
$arg4 = $fileName
Write-Host "Uploading " $fileName
& $app $arg1 $arg2 $arg3 $arg4

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: Code not working on 1 board but fine on other two

Post by davef » Wed Jul 07, 2021 8:46 pm

First thing I'd check is ... what chip is reported by esptool and what revision.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Code not working on 1 board but fine on other two

Post by jimmo » Thu Jul 08, 2021 1:15 am

mc2software wrote:
Wed Jul 07, 2021 4:25 pm
What might cause one board to not operate properly?
What does "not operate properly" mean?

As davef said, worth checking that they're all the same ESP32 chip, but also can you confirm that they're the same board? (i.e. same brand and model).

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: Code not working on 1 board but fine on other two

Post by davef » Thu Jul 08, 2021 1:30 am

All my ESP32_Devkitc_v4, from Aliexpress, according to several sources should have rev3 chips. esptool v3.1 report them at rev1.

mc2software
Posts: 22
Joined: Wed Jan 13, 2021 6:08 pm
Location: Northern Florida

Re: Code not working on 1 board but fine on other two

Post by mc2software » Fri Jul 09, 2021 1:54 pm

More clarification: all boards are identical; the leds, buttons and MAX7219s operate as expected with two boards, but on one the buttons don't register and the leds don't display as they should. Bad board?

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Code not working on 1 board but fine on other two

Post by jimmo » Sat Jul 10, 2021 12:24 pm

mc2software wrote:
Fri Jul 09, 2021 1:54 pm
More clarification: all boards are identical; the leds, buttons and MAX7219s operate as expected with two boards, but on one the buttons don't register and the leds don't display as they should. Bad board?
It sounds like it... debugging this further is going to require either:

a) See if you can make the buttons / LEDs work using a different approach (e.g. Arduino or ESP-IDF directly) (to rule out MicroPython)

b) Physically try and trace the fault on the board (i.e. probing the CPU pins) (to confirm board issue).

Has the board ever worked?

efahl
Posts: 15
Joined: Sat Dec 23, 2017 2:02 pm

Re: Code not working on 1 board but fine on other two

Post by efahl » Sat Jul 10, 2021 3:24 pm

Just a shot in the dark here, but how are you powering the boards? I have a half dozen ESP8266s that are mostly identical, but one of them won't flash when powered from a marginal supply. If I plug it into a high amperage USB port it flashes fine, but when plugged into a sub-1-amp port on an ancient desktop, it fails almost every time.

mc2software
Posts: 22
Joined: Wed Jan 13, 2021 6:08 pm
Location: Northern Florida

Re: Code not working on 1 board but fine on other two

Post by mc2software » Mon Jul 12, 2021 7:00 pm

The board had worked when it was flashed with Arduino. But I'm also using a different computer now, going through a USB hub built into the monitor. Maybe I'll try my other PC, where I use a powered USB hub. Bought a few new boards and will see if they work. Will also try 1.16 with all of them to see if the same thing happens. May not have an update on the result for a few weeks.

Post Reply