In-Circuit Programming of SPI NOR Flash ROM
#1
This approach uses additional hardware to probe, read, write, verify and erase the 128Mbit SPI NOR flash found on the Pinebook Pro.  Although this should work on the PBP's cousins (ROCKPro64, ROCK64, PINE A64-LTS, PINE H64 vB, CUBE?), the process has only been thoroughly tested on the PBP.

In summary, I used a Raspberry Pi (with monitor and USB keyboard), a USB flash drive, a test clip, a breadboard with jumper wire, and an external 3V3 power supply to perform in-circuit operations on the installed GD25Q127C SPI NOR flash ROM successfully. This post is being made with the Pinebook Pro I own and used in the experiments.  

WARNING: I accept no liability for any outcome that results from any use of this information.

I can confirm that, at least on my unit, the SPI NOR flash ROM arrives empty. You will find a detailed write up of the entire process at this link:

https://gist.github.com/hxmuller/1c209d2...37237b649e

The Pine64 single board computers (SBCs) might work as well, I just don't own any to test with.
  Reply
#2
Thumbs Up 
I was looking for exactly this info - huge thanks for sharing!

The description looks quite similar to flashing the SPI flash in other notebooks in order to install coreboot there, so it sounds quite familiar. I was just surprised that the Pomona 5250 is supposed to fit here as I was expecting soldering to be necessary.

The only thing I did not fully understand yet: You say that supplying 3.3V from an external source is necessary because the RPI does not supply enough power to power the PBP. However, I do not understand why the PBP is powered at all during flashing? Can't this be done with the PBP being off all the time? For the SPIs I flashed on various Lenovo mainboards this was not necessary, i.e. I supplied 3.3V from the RPI and everything was fine.

Last but not least: I am pretty sure flashing can be done using a rock64 or a64 as well. If I find the time to test this I will share my experience with that.
  Reply
#3
(12-25-2019, 08:36 PM)hmuller Wrote: < SNIP >

I can confirm that, at least on my unit, the SPI NOR flash ROM arrives empty. You will find a detailed write up of the entire process at this link:

https://gist.github.com/hxmuller/1c209d2...37237b649e

Does this mean - at least to the best knowledge - that a desired uBoot image could be flashed in place to the SPI? Is there any special parameterization, other than the usual image, that would be required?

It seems that the risk of screwing this up is minimal. Since the default state is a blank SPI image, then any failed attempts could be recovered by zeroing the SPI as you describe. Is this also right?

Thanks much,
— Jeremiah Cornelius
"Be the first person not to do some­thing, that no one has thought of not doing before’’
— Brian Eno, "Oblique Strategies"
  Reply
#4
(01-02-2020, 12:30 PM)Jeremiah Cornelius Wrote: ...
Does this mean - at least to the best knowledge - that a desired uBoot image could be flashed in place to the SPI? Is there any special parameterization, other than the usual image, that would be required?
...
The SPI can be flashed from the OS, no special hardware needed. Only special software. The U-Boot image would be similar to an eMMC or SD card image.

(01-02-2020, 12:30 PM)Jeremiah Cornelius Wrote: ...
It seems that the risk of screwing this up is minimal. Since the default state is a blank SPI image, then any failed attempts could be recovered by zeroing the SPI as you describe. Is this also right?

Thanks much,
Correct. If something does go wrong, you would be able to over-write the SPI with zeros and then the SoC would follow the next device, (eMMC, then SD card).

So a bad SPI image would soft-brick a Pinebook Pro. Annoying recovery, but possible without cutting a leg off the SPI, or un-soldering the SPI.
--
Arwen Evenstar
Princess of Rivendale
  Reply
#5
(01-02-2020, 11:22 AM)kuleszdl Wrote: huge thanks for sharing!

I was just surprised that the Pomona 5250 is supposed to fit here as I was expecting soldering to be necessary.

You say that supplying 3.3V from an external source is necessary because the RPI does not supply enough power to power the PBP. However, I do not understand why the PBP is powered at all during flashing? Can't this be done with the PBP being off all the time? For the SPIs I flashed on various Lenovo mainboards this was not necessary, i.e. I supplied 3.3V from the RPI and everything was fine.

Last but not least: I am pretty sure flashing can be done using a rock64 or a64 as well. If I find the time to test this I will share my experience with that.

You are welcome, and no problem. 

The Pomona 5250 clip fits securely on the chip. 

When I first created the circuit without an external power supply, then attempted to power up the Raspberry Pi, the board (not just the SPI NOR flash chip) drew too much power from the 3V3 power pin, and the Raspberry Pi went into a boot loop. Note that I disconnected the battery from the main board on the PBP and it was not powered on at any time during the process. I did this to limit any interference from the operating system or hardware while flashing the chip. 

Any of the Pine64 SBCs (sopine only with baseboard), I look forward to your results.

(01-02-2020, 12:30 PM)Jeremiah Cornelius Wrote: Does this mean - at least to the best knowledge - that a desired uBoot image could be flashed in place to the SPI? Is there any special parameterization, other than the usual image, that would be required?

It seems that the risk of screwing this up is minimal. Since the default state is a blank SPI image, then any failed attempts could be recovered by zeroing the SPI as you describe. Is this also right?

Thanks much,

Yes, u-boot can be flashed to the SPI NOR flash ROM. I am working on that at the moment, but have paused while working on a Raspberry Pi SWD solution because I want to be able to debug any problems I create =). My current understanding is that that the current u-boot setup in place on the factory installed PBPs is configured for eMMC boot with fall back to SD card. It is not clear to me whether mrfixit's u-boot can simply be flashed to the SPI NOR flash ROM, but I suspect not.

Yes, If you have the means to flash the ROM, recovery from errors could be as simple as erasing the ROM. The ROM is rated at a minimum 100K program/erase cycles, and typically retains data for 20 years. So you should be able to safely conduct 13 program/erase cycles per day for 20 years. I would not recommend doing that, but it should be possible.

(01-04-2020, 09:58 PM)Arwen Wrote: The SPI can be flashed from the OS, no special hardware needed. Only special software.
I played around with the installed u-boot to see if I could flash from u-boot and hit a couple blocks, if I remember right it could not see the SPI NOR flash nor would it see any of my flash drives. So I think u-boot requires a little work in that department. Flashrom does not detect the flash when run from the default Debian desktop:

Code:
$ sudo flashrom -p internal -c GD25Q128C

If you are aware of another solution, post a link please!
  Reply
#6
I think Arwen may have been referring to rkdeveloptool.
  Reply
#7
No, there is a software tool specifically for flashing the SPI in the RockPro64 & Pinebook Pro, (which both use the RK3399 SoC & similar setup for SPI).

I don't have the name of the program. One of the main developers has it, (and a different one for the other Pine64 boards that use different hardware).

Eventually I would like to see the Pinebook Pro Wiki include all this information. But, it's still early days for using the SPI.
--
Arwen Evenstar
Princess of Rivendale
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)