Skip to content

uart programming #1

@Kevin-010

Description

@Kevin-010

Note: I use this code for production programming of devices as it is (for whatever reason) significantly faster and more robust than the tcl scriptable programmer. great job there.
for some reason the code as-is only supports usb programming despite the protocol for uart being identical - the baud is configured, but incorrectly for the sam-ba uart. note that baud is ignored for cdc serial and doesn't affect the data rate
tiny patch to enable programming over uart:

diff --git a/comm.c b/comm.c
index 0183c2a..af91a21 100644
--- a/comm.c
+++ b/comm.c
@@ -70,7 +70,7 @@ int samba_open(const char* device)
                return -1;
        }
 
-       if (!configure_tty(fd, B4000000)) {
+       if (!configure_tty(fd, B115200)) {
                close(fd);
                return -1;
        }

also note for any users here, the chip ids need updating for new device revisions. eg:

diff --git a/chipid.c b/chipid.c
index eb5e60b..041fb77 100644
--- a/chipid.c
+++ b/chipid.c
@@ -29,7 +29,8 @@ static const struct _chip _chips_samx7[] = {
        { "SAMS70Q21", 0xa1120e00, 0x00000002, 0x400e0c00, 0x00400000, 2048, 9 },
        { "SAMS70Q20", 0xa1120c00, 0x00000002, 0x400e0c00, 0x00400000, 1024, 9 },
        { "SAMS70Q19", 0xa11d0a00, 0x00000002, 0x400e0c00, 0x00400000,  512, 9 },
-       { "SAMS70N21", 0xa1120e00, 0x00000001, 0x400e0c00, 0x00400000, 2048, 9 },
+       { "SAMS70N21A", 0xa1120e00, 0x00000001, 0x400e0c00, 0x00400000, 2048, 9 },
+       { "SAMS70N21B", 0xa1120e01, 0x00000001, 0x400e0c00, 0x00400000, 2048, 9 },
        { "SAMS70N20", 0xa1120c00, 0x00000001, 0x400e0c00, 0x00400000, 1024, 9 },
        { "SAMS70N19", 0xa11d0a00, 0x00000001, 0x400e0c00, 0x00400000,  512, 9 },
        { "SAMS70J21", 0xa1120e00, 0x00000000, 0x400e0c00, 0x00400000, 2048, 9 },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions