MultiWii on Cortex M0 with 16kb flash? (toy quadcopter)

Post Reply
cpldcpu
Posts: 2
Joined: Sun Sep 22, 2013 7:18 pm

MultiWii on Cortex M0 with 16kb flash? (toy quadcopter)

Post by cpldcpu »

Dear MultiWii community,

I am quite new to multiwii and have no experience with it. I recently bought a cheap chinese quadcopter (<30$, JXD 385) and was surprised to find that it worked quite well.
When I opened it, I found quite familiar hardware: A MPU6050 inertial sensor, a BK2324 (nrf24L01 clone) tranceiver and a Nuvoton MINI54ZAN MCU. The microcontroller
is a Cortex M0 with 16kb flash and 2 kb sram. Interestingly all relevant ports of the MCU have been brought out on the PCB (see attachment). It seems likely that it is possible to reprogram
it. For various reasons it would be interesting to use a custom firmware. So far, I have not been successful in locating the original firmware.

One other option of course, would be to port an existing quadcopter firmware to this device. Would it be possible to port MultiWii to this platform, given the little available memory? Is there already an existing port for the Cortex M0? I notice it has been ported to the M3..
Attachments
ports.jpg

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: MultiWii on Cortex M0 with 16kb flash? (toy quadcopter)

Post by timecop »

If you get rid of all the configuration stuff from baseflight, it should be small enough
alternatively, you can take a look at https://github.com/trollcop/bradwii which might be a good starting point for something small that isn't bloated up yet.

Assuming the chip has some peripherals for PWM/etc it shouldn't be that hard, but you'll spend most of the time writing low-level drivers.

cpldcpu
Posts: 2
Joined: Sun Sep 22, 2013 7:18 pm

Re: MultiWii on Cortex M0 with 16kb flash? (toy quadcopter)

Post by cpldcpu »

timecop wrote:If you get rid of all the configuration stuff from baseflight, it should be small enough
alternatively, you can take a look at https://github.com/trollcop/bradwii which might be a good starting point for something small that isn't bloated up yet.

Assuming the chip has some peripherals for PWM/etc it shouldn't be that hard, but you'll spend most of the time writing low-level drivers.


Thank you for the link. I compiled bradwii with barometer, gps and compass turned off and it already got quite small:

>Program Size: Code=17572 RO-data=564 RW-data=516 ZI-data=7148

The main dealbreaker right now is the size of ZI-data. Where are 7+kb of sram used?

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: MultiWii on Cortex M0 with 16kb flash? (toy quadcopter)

Post by timecop »

Probably stack - it's 0x1000 in the default cortex M3 startup file it ships with
Program Size: Code=24936 RO-data=564 RW-data=596 ZI-data=3196 after dropping stack back down to 0x200.
Just look at the map file keil builds - it will show you exactly what sram is used for.

I've not looked at cleaning up the code at all - there's probably a lot of ROData that isn't being RO because of dumb tarduino porting. I see already shit like:
.data 0x20000048 Section 123 checkboxes.o(.data)
which means there's 123 bytes of ram being wasted for something stupid in that file.

User avatar
linuxslate
Posts: 91
Joined: Mon May 13, 2013 3:55 pm

Re: MultiWii on Cortex M0 with 16kb flash? (toy quadcopter)

Post by linuxslate »

Just a note that the WLToys V252 is a very similar toy Quadcopter.

I own 2 V252's and I have flown the JXD 385, and they fly very similarly. I now see that it is not coincidence. The 2 boards seem to be very similar.

The V252 board also has the ports brought out to pads:

Image

I'm not at the level to write drivers, but I would love to put MultiWii (or anything I could mess with) on my V252.

User avatar
600baud
Posts: 5
Joined: Mon Jun 02, 2014 5:01 am

Re: MultiWii on Cortex M0 with 16kb flash? (toy quadcopter)

Post by 600baud »

sorry to necro this thread, I've just purchased a V282 & V272 for about AUD$20 each with the hope of controlling them via the cheap nrf24l01+ transceiver.
I'm not familiar with flashing such devices but have reasonable experience in reverse engineering these types of communication protocols and I'm optimistic in being able to bind to these quads. Obviously flashing the quad and reverse engineering the comms is completely different though being able to do either would be great - making them very popular for hackers, tinkerers and hobbyist's at a price of roughly AUD$24 for all the parts.

Post Reply