Skip to content

Commit d66cb93

Browse files
authored
Merge pull request #1 from nfd/master
sync with nfd/spi-flash-programmer
2 parents 3df69c7 + e6dfe5c commit d66cb93

File tree

3 files changed

+325
-121
lines changed

3 files changed

+325
-121
lines changed

README.md

100644100755
Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,30 +78,48 @@ Connected to 'SPI Flash programmer v1.0'
7878
Connected to 'SPI Flash programmer v1.0'
7979
[########### ] 383/1024 - 00:01:13
8080

81+
# Set IO Pin value
82+
# Example: IO pin 0x2, set to LOW
83+
> python3 spi_flash_programmer_client.py \
84+
> -d COM1 --io 0x2 --value 0x0 set-output
85+
86+
# Override ChipSelect pin
87+
# Example: use IO pin 13/0xd
88+
> python3 spi_flash_programmer_client.py \
89+
> -d COM1 --io 0xd set-cs-io
90+
8191
# Help text
8292
> python3 spi_flash_programmer_client.py -h
8393
usage: spi_flash_programmer_client.py [-h] [-d DEVICE] [-f FILENAME]
8494
[-l LENGTH] [--rate BAUD_RATE]
8595
[--flash-offset FLASH_OFFSET]
86-
[--file-offset FILE_OFFSET]
87-
{ports,write,read,verify,erase}
96+
[--file-offset FILE_OFFSET] [--pad PAD]
97+
[--debug {off,normal,verbose}] [--io IO]
98+
[--value VALUE]
99+
{ports,write,read,verify,erase,enable-protection,disable-protection,check-protection,status-register,id-register,set-cs-io,set-output}
88100

89101
Interface with an Arduino-based SPI flash programmer
90102

91103
positional arguments:
92-
{ports,write,read,verify,erase}
104+
{ports,write,read,verify,erase,enable-protection,disable-protection,check-protection,status-register,id-register,set-cs-io,set-output}
93105
command to execute
94106

95107
optional arguments:
96108
-h, --help show this help message and exit
97109
-d DEVICE serial port to communicate with
98110
-f FILENAME file to read from / write to
99-
-l LENGTH length to read/write in kibi bytes (factor 1024)
111+
-l LENGTH length to read/write in bytes, use -1 to write entire
112+
file
100113
--rate BAUD_RATE baud-rate of serial connection
101114
--flash-offset FLASH_OFFSET
102115
offset for flash read/write in bytes
103116
--file-offset FILE_OFFSET
104117
offset for file read/write in bytes
118+
--pad PAD pad value if file is not algined with SECTOR_SIZE
119+
--debug {off,normal,verbose}
120+
enable debug output
121+
--io IO IO pin used for set-cs-io and set-output
122+
--value VALUE value used for set-output
105123
```
106124
107125
Troubleshooting
@@ -150,3 +168,18 @@ I guess if you do a system upgrade which puts the kernel image somewhere after t
150168
151169
If you try this, let me know!
152170
171+
Flashing iCE40HX8K-EVB from Olimex
172+
==================================
173+
This example uses the OLIMEXINO-32U4 to flash a Olimex iCE40HX8K-EVB. The steps should also work with a iCE40HX1K-EVB.
174+
175+
The board is connected using the UEXT connector.
176+
```bash
177+
# Set iCE40-CRESET LOW - PIN 0x2
178+
> python3 spi_flash_programmer_client.py -d COM1 --io 0x2 --value 0x0 set-output
179+
# Set CS/SS to PIN 13/0xd
180+
> python3 spi_flash_programmer_client.py -d COM1 --io 0xd set-cs-io
181+
# power cycle the EVB, check if ID register is readable
182+
> python3 spi_flash_programmer_client.py -d COM1 id-register
183+
# program the bitmap
184+
> python3 spi_flash_programmer_client.py -d COM1 -l -1 --pad 0xff -f toplevel_bitmap.bin write
185+
```

0 commit comments

Comments
 (0)