Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ The version lives in `_VER` in `src/main.c`. Binaries are published only as the
[`latest`](https://github.com/OpenIPC/microsnander/releases/latest) release, rebuilt
from every push to `main`; this file is the change history.

## 1.47.3 — 2026-11-17

- SigmaStar ISP (`-m sigmastar`): a read sends the bridge's read command (0x11) once, not before
every I2C part; the bridge dropped a byte at each repeat, so every 25th byte of a CH341A read
was missing and a verify after a write failed at 0x18 (#97, by @igorssv).
- `tests/ispsim.c`: the simulated bridge drops a byte at a repeated 0x11, as the real one does.

## 1.47.2 — 2026-11-17

- Android app: without a password the page takes only addresses and the names under the camex
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
struct flash_cmd prog;
extern unsigned int bsize;

#define _VER "1.47.2"
#define _VER "1.47.3"

const char *ms_version = _VER;

Expand Down
5 changes: 3 additions & 2 deletions src/sigmastar.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* UART of the SoC goes to it, TX to SDA, RX to SCL, and GND.
*
* The bridge answers at 0x49: 0x10 and bytes — they go out on the SPI bus;
* 0x11 — the next I2C read clocks bytes in from it; 0x12 — the end of the
* 0x11 — the next I2C reads clock bytes in from it (once per command: a 0x11
* again under the same CS drops a byte); 0x12 — the end of the
* SPI command (CS high). Before that the SoC's debug port, 0x59, is told to
* let the pins of its UART be the bridge, and "MSTAR" to 0x49 starts it.
* The flash drivers do not know: the programmer's send and cs go here.
Expand Down Expand Up @@ -81,7 +82,7 @@ static int isp_send(unsigned int writecnt, unsigned int readcnt, const unsigned
unsigned int n = readcnt - done < bus->i2c_max ? readcnt - done : bus->i2c_max;

buf[0] = ISP_READ;
if (bus->i2c_write(ISP_ADDR, buf, 1) || bus->i2c_read(ISP_ADDR, readarr + done, n))
if ((done == 0 && bus->i2c_write(ISP_ADDR, buf, 1)) || bus->i2c_read(ISP_ADDR, readarr + done, n))
return -1;
done += n;
}
Expand Down
7 changes: 4 additions & 3 deletions tests/ispsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ static int f_write(unsigned char a, const unsigned char *b, unsigned int n)
if (n == 5 && !memcmp(b, "MSTAR", 5)) { if (refuse_mstar) return -1; mstar++; return 0; }
switch (b[0]) {
case 0x10: if (reading) bad = 2; memcpy(cmd + ncmd, b + 1, n - 1); ncmd += n - 1; return 0;
case 0x11: if (n != 1) bad = 3; reading = 1; return 0;
/* a 0x11 again under the same CS costs a byte: the bridge clocks one in and drops it (#97) */
case 0x11: if (n != 1) bad = 3; if (reading) clocked++; reading = 1; return 0;
case 0x12: if (refuse_end) return -1; if (n != 1) bad = 4; ends++; ncmd = clocked = 0; reading = 0; return 0;
default: bad = 5; return -1;
}
Expand Down Expand Up @@ -88,12 +89,12 @@ int main(void)
check(!p->cs(true) && !p->send(1, 3, (const unsigned char[]){ 0x9f }, id) && !p->cs(false) &&
id[0] == 0xef && id[1] == 0x40 && id[2] == 0x18 && ends == 1, "READ ID through the bridge: ef 40 18, then 0x12");

/* READ of 200 bytes at 0x1234: the read goes in parts of the I2C limit, each after a 0x11 */
/* READ of 200 bytes at 0x1234: one 0x11, then reads in parts of the I2C limit */
int same = 1;
p->cs(true);
check(!p->send(4, sizeof(buf), (const unsigned char[]){ 0x03, 0x00, 0x12, 0x34 }, buf) && !p->cs(false), "READ of 200 bytes");
for (unsigned int i = 0; i < sizeof(buf); i++) same &= buf[i] == pattern(0x1234 + i);
check(same && max_part <= 24 && !bad, " the data comes back in order, no I2C transaction over 24 bytes");
check(same && max_part <= 24 && !bad, " the data comes back in order, no byte lost between the parts, no I2C transaction over 24 bytes");

/* a page program: 4 bytes of command and 256 of data out in parts of 23, all under one CS */
for (unsigned int i = 0; i < sizeof(wr); i++) wr[i] = (unsigned char)i;
Expand Down
Loading