Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete sn32f2xx support, add functionality #5

Merged
merged 46 commits into from
Sep 14, 2024

Conversation

dexter93
Copy link
Contributor

@dexter93 dexter93 commented Sep 6, 2024

Supports all sn32f2xx chips
Add options for flash erase, CS re/set and data verification
Simplify and correct the protocol usage

Automagic chip identification, no longer VID/PID bound

@Jpe230
Copy link
Collaborator

Jpe230 commented Sep 7, 2024

Woops, vscode had a fart and each suggestion was sent individually, sorry.... Still, lgtm, just some formatting suggestion....

Copy link

@karliss karliss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick for the description of PR - this doesn't cover all the SN32F200 chips. It doesn't take into account SN32f239 and SN32f229. Not suggesting it's necessary to support them, just that the description could be adjusted.

sonixflasher.c Outdated Show resolved Hide resolved
sonixflasher.c Outdated Show resolved Hide resolved
sonixflasher.c Outdated Show resolved Hide resolved
sonixflasher.c Outdated Show resolved Hide resolved
write_buffer_16(buf + 6, CS0); // WARNING THIS SETS CS0
if (!hid_set_feature(dev, buf, REPORT_SIZE)) return false;
if (!hid_get_feature(dev, buf, CMD_SET_ENCRYPTION_ALGO)) return false;
clear_buffer(buf, REPORT_SIZE);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useless clearing of local stack buffer which is about to go out of scope. Same thing in next few functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly being extra careful with buffer management here while implementing undocumented bits of the protocol

@dexter93
Copy link
Contributor Author

Minor nitpick for the description of PR - this doesn't cover all the SN32F200 chips. It doesn't take into account SN32f239 and SN32f229. Not suggesting it's necessary to support them, just that the description could be adjusted.

Mostly avoided them because of bad/missing docs. However, looking at it again the protocol is compatible and they're simply a revision of 240

index,bl_version,family,revMajor,revMinor
SN32F249
12,0x01 0x20 0x00 0x03
SN32F239
13,0x01 0x20 0x00 0x02
SN32F229
14,0x01 0x20 0x00 0x01

That also means the version check atm is buggy, since it will identify 230 and 220 chips as 240 ( issues arising from this are related to flash size on erase/program). Definitely a nice find, will amend

Copy link

@karliss karliss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good enough for me.

With which chips has the new code been actually tested?

@dexter93
Copy link
Contributor Author

Testing being done on specific platform samples
240b works ( covers also 260)
290 works ( covers also 280, 240C)
240 tested up until v2.0.3 - worked fine ( should also cover the now unobtainable 220/230)

Copy link

@HorrorTroll HorrorTroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

240 series work good on latest commit.

@dexter93 dexter93 merged commit 2a46977 into SonixQMK:main Sep 14, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants