Live data from Hacker News

Reverse engineering my e-scooter and rewriting the firmware in Rust

bensimms.moe

31–40 of 113 posts

Re: Reverse engineering my e-scooter and rewriting the firmware in Rust

#31
post #6
post #4

Wish I was brainy enough to do this sort of thing!

That's what is nice about LLMs. You CAN do these things now!

I'd be pretty careful with this kind of thing. My friend vibe coded something similar and it had some very unexpected real world bugs like instantly locking the engine, cranking the engine to 100 in a second and burning the motor out, etc. So something like an escooter that you might ride across a busy road may not be the best use of vibe coding.

Re: Reverse engineering my e-scooter and rewriting the firmware in Rust

#32
post #24

> The updater device then sends 64 byte chunks spread over 9 CAN 0x384 frames Classic CAN uses 8 bytes long frame, so 64 bits. Is it a typo in the post, vor is it using CAN-FD?

I read this as the chunks are 64 bytes and thus each chunk is split over 9 frames. I haven’t looked yet but it’s probably an ISO-TP esque framing protocol.

Yep, this is the case. Nine frames are transmitted with the first frame containing a sequence number and the first five bytes, followed by seven frames containing just data, and a final frame containing the last three bytes of data, and a two byte CRC.

Re: Reverse engineering my e-scooter and rewriting the firmware in Rust

#33
post #30
post #25

This is an unbelievably impressive project and a killer write up, very satisfying. I wonder if the author looked into using Slint [1] for the UI, given the codegen bloat issues they had with buoyant (which also looks very cool). I haven't used either, but I've done a few projects with Embassy and am always looking for an excuse to try embedded GUI tools [1] https://slint.rs/

Heya, I tried using slint first, but slint needs even more flash, and an allocator on top. Just adding slint (with an empty UI) exhausted my binary size limit.

Oh wow, good to know! Cool project, best of luck with your motor controller firmware

Re: Reverse engineering my e-scooter and rewriting the firmware in Rust

#35
post #21

I am also rusting my hw. Last week my mouse, this week my EUC (wish me luck). I would rather risk a crash than memory corruption

What is an EUC? And also what kinda crash are you referring to? i rather have a memory issue than crash my e-scooter (and myself) haha

in this context, it likely refers to an electric unicycle (https://en.wikipedia.org/wiki/Electric_unicycle)

Re: Reverse engineering my e-scooter and rewriting the firmware in Rust

#36
post #10

Earlier quoted context omitted.

If it is coded in safe Rust, why not ?

Safe rust does not mean correct logic; best not conflate the two. You could have perfectly safe rust that disables brakes above a certain speed, inverts steering by wire, or adjusts the charging parameters, for example (depending on addressable capabilities).

I meant something deeper.

Re: Reverse engineering my e-scooter and rewriting the firmware in Rust

#37
post #34

We need to free up Bosch systems. They use lots of open source libs, but they close the whole chain (like spare batteries) so that you cannot plug external batteries from other suppliers.

Pretty much anything hardware based is like this. Everything is 100% closed source and bolted down such that inspecting it is outright impossible without extensive reverse engineering.

Re: Reverse engineering my e-scooter and rewriting the firmware in Rust

#38
post #6

Earlier quoted context omitted.

That's what is nice about LLMs. You CAN do these things now!

I'd be pretty careful with this kind of thing. My friend vibe coded something similar and it had some very unexpected real world bugs like instantly locking the engine, cranking the engine to 100 in a second and burning the motor out, etc. So something like an escooter that you might ride across a busy road may not be the best use of vibe coding.

You can use an LLM but you have the provide the spec of the motor and the surrounding hardware apparatus. Not every motor is the same.

Re: Reverse engineering my e-scooter and rewriting the firmware in Rust

#40
post #30
post #25

This is an unbelievably impressive project and a killer write up, very satisfying. I wonder if the author looked into using Slint [1] for the UI, given the codegen bloat issues they had with buoyant (which also looks very cool). I haven't used either, but I've done a few projects with Embassy and am always looking for an excuse to try embedded GUI tools [1] https://slint.rs/

Heya, I tried using slint first, but slint needs even more flash, and an allocator on top. Just adding slint (with an empty UI) exhausted my binary size limit.

I've got a happy run G300 pro that has a controller I've been considering digging into. It doesn't seem tuned to the motor. This is great inspiration to start digging in. It actually seems a bit clever to use the USB pins as a CAN bus
Post reply on HN