Paul Sokolovsky | 272fad6 | 2016-04-14 18:54:11 +0300 | [diff] [blame] | 1 | import esp |
| 2 | import uctypes |
| 3 | |
| 4 | |
| 5 | def main(): |
| 6 | |
| 7 | ROM = uctypes.bytearray_at(0x40200000, 16) |
| 8 | fid = esp.flash_id() |
| 9 | |
| 10 | print("Flash ID: %x (Vendor: %x Device: %x)" % (fid, fid & 0xff, fid & 0xff00 | fid >> 16)) |
| 11 | |
| 12 | print("Flash bootloader data:") |
| 13 | SZ_MAP = {0: "512KB", 1: "256KB", 2: "1MB", 3: "2MB", 4: "4MB"} |
| 14 | FREQ_MAP = {0: "40MHZ", 1: "26MHZ", 2: "20MHz", 0xf: "80MHz"} |
| 15 | print("Byte @2: %02x" % ROM[2]) |
| 16 | print("Byte @3: %02x (Flash size: %s Flash freq: %s)" % (ROM[3], SZ_MAP.get(ROM[3] >> 4, "?"), FREQ_MAP.get(ROM[3] & 0xf))) |
| 17 | |
| 18 | |
| 19 | main() |