Firmware development updates

Today there was a weird power supply bug while trying to glitch hack an SLE4442 card. There are two ways we disable the power supply:

  • Use the DAC (PWM) to set 0volts, 0mA current at the VREG
  • Use a 595 pin CURRENT_EN to override the current limit output

What I noticed is that CURRENT_EN wasn’t working on its own. That led to a half day dig into the code and hardware. It turns out to be some absolutely bizarre repeatable missing bit error due to the speed we run the shift registers AND the temperature in my workshop (freezing today!). So, I fixed that.

While in there, I tried to raise the SPI speed for the LCD and flash to full speed. The NAND does not like that at all. It should work to 100MHz, so my guess is some setup or between frame delay requirements are not being met at 62.5MHz.

I’m going to increase the display speed to full, and shift down to 31.25MHz for the NAND for now. This only applies to REV10+, REV8 has to stay <20MHz to avoid de-configuring the SD card.

Also @grymoire: There should be a fix for that spurious over current error. I could reproduce it at low currents, and now it seems to be fixed. Thank you so much!

New firmware should be ready by now. Enjoy!

Fixed a bug in SLE4442 smart card set new password where the successful change was register as an error.

image

flash read -o -b <bytes> -f <file>

Added a force/override to flash reads on unknown chips:

  • -o override when init fails (unknown chip)
  • -b <bytes> specify how many bytes to read

If the chip can’t be identified, the flash command uses the most common 0x03 read command and a three byte start address of 0x00 0x00 0x00, then dumps <bytes> bytes to <file>.

1 Like

Just to chime in on the hardware revisions, I think it makes sense to push the rev8 firmware into a sub-directory of the auto build zip file so that the user is only presented with a single .uf2 by default.

I don’t personally have an issue with the current arrangement. But as more people get their hands on the BP5, it’s inevitable that it’s going to become one of those gotchas that is going to keep coming up.

1 Like

HUGE bug fix in SPI. It seems like I probably typed something in the wrong window and deleted the return value on reads. Not sure when that happened, I’ve been working with it non-stop and it was going fine.

Available mode commands are now printed in the global help output. I wanted a “single source of truth” without hiding stuff in lower mode layers. They are still included in the help mode mode specific help.

AND… I just noticed that the gps and bridge have the wrong help. I’ll push a fix.

1 Like

Lots of small updates:

  • SPI read with write implemented
  • I2C bug fixed where NACK was not issued because a number was hardcoded instead of using the bytecode defines (which changed recently)
  • @gabri74 added some flags and options to the hex command
  • Updated docs with information on the translation python script
  • Updated repos with readme.md
1 Like

I don’t know if this thread is the right place for this, but I have two small feature requests:

  1. add a display mode that shows a user defined text on the display
  2. add a command that waits for a button press with a user definable timeout. Maybe output the button hold time to allow the script to differentiate between short press and long press (after debounce)

The idea behind this is to use the BusPirate in some basic process automation without needing a dedicated monitor on the PC. A script on the PC decides to show some message to the user. Afterwards sends the “wait for button” command with a 0.5s timeout. On timeout it repeats the button check command. When the user doesn’t press the button, the program can still interact with the BusPirate every 0.5s and also react in a timely manner to the button press.

1 Like

Great ideas, I like it. The button functionality will come very soon. Writing to screen may take a bit longer.

@Gabri74 updated the macro system to run syntax from text files on the NAND flash drive.

Macros and comments are stored in .mcr files: macro.zip (428 Bytes)

A new compile should arrive shortly.

image

There’s a new macro command to set the macro file, list macros, and run macros.

Loading a macro file and listing available macros.

Running a macro file.

This may also be a good time to start adding the other disk-as-database features.

It was strangely easy to add scripting. The latest build has two new commands: script and tutorial. Both are based on the same scripting system.

# This is a sample tutorial!
# Welcome!
# This is some syntax, hit enter to execute it!
[0x00 0xff r:2]
# This is a comment! It's not executed!
# Here's a full on command!
# Hit enter to execute it!
pause
# Did it pause?

Very simple text format for tutorials and scripts.

  • Lines with # are comments and will (optionally) be printed in the terminal.
  • Anything else is shoved into the command prompt to be executed

Options:

  • -p pause at each command prompt and wait for<enter> key
  • -d don’t display comments
  • -e exit script in case of an error

tutorial is just an alias of script with fixed settings & a first-prompt tip to hit enter.

There’s a new git repo for scripts, tutorials, macros, datasources, etc. Feel free to make pull requests, please include some kind of name/handle and license. Eventually there will be a second download of datasources to copy to the flash drive, in addition to the firmware.

Scripting is recursive, and may need to move to the main loop statemachine…

There are also some minor updates to the user defined macro mode.

1 Like

It’s been a bit of a catch up week. Moving forward, these are my debugging priorities:

  • Boards with broken LEDs and boot issues (an old firmware may work, and contain the solution)
  • Boards the freeze on flash dump
  • Confirm flash command is read/writing properly. Could be an issue in the Universal Flash Driver library or it’s implementation on the Bus Pirate.
  • Freezing in the script/tutorials when opening a second file from the script

It feels like we have a critical mass of people needed to define the binary mode and how it should work. I’m looking forward to getting that added in the next week or two.

The various little 8 pin flash chip adapters went to production last week. I feel like they’ll be assembled Tuesday. New week I’ll cover the flash adapters sourcing ‘story’ on social media, which you may have already seen here. It would be really nice to conclude that with getting //some kind// of SPI flash read/writer PC software going.

1 Like