Maple Mini and CooCox

Last year, I came across the Maple Mini microcontroller (http://goo.gl/G5579s) which is an ARM based arduino equivalent that came before the arduino due. It really helped me jump into the world of arm controllers and I think that its a really great little board! Unfortunately, they stopped support for windows quite a while back and the IDE is horrible, along with being extremely temperamental.

As I think that the STM32 discovery boards are absolutely amazing apart from the fact they aren’t particularly breadboard-able, I decided to try and program my Maple Mini using the STLink present on my discovery board.

After a couple of hickups, its a complete success! A standard GPIO toggle program was run and it was producing a frequency of 960kHz, showing that atleast something was working initially! It surprisingly easy to use some jumper wires from the SWD output of the STM32 Discovery to the maple.

For those who are interested:

  • TCK/SWCLK to D21
  • TMS/SWDIO to D22
  • NRST to D18
  • SWO to D20

Image

The sketch for the Maple board within CooCox

Image

Logic analysis of PA0 toggling

Now that I’ve managed to get the STLink working with the Maple, I’ve got an easily breadboard-able ARM based platform at 72MHz and little additional effort is required other than connecting 4 wires for programming!

Image

Fresh new breadboarding platform!

Advertisements

8 responses to “Maple Mini and CooCox

  1. Did you just use the st-link exe to flash the program after you compiled? Or did you get it working directly in CoIDE?

    • Hey! I didn’t have to use the external utility as by wiring up the Maple Mini to the STM32F0 discovery board’s STLink section, and disabling the onboard processor with the jumpers, I could supply power and program the Maple as if it were a standard STM32F0 microcontroller.

      • Awesome, I have been a little disappointed and surprised at the lack of tools and proper documentation on most of the stm32 stuff. Have you found any good locations/forums for stm32 projects?

        Also, I’m a bit suprised at the low speed of the pin switching in the above example. Have you tried swapping the while(1) with a for(;;), just curious since I am waiting on my maple minis, (I’m currently stuck with a stack of seemingly unsupported STM32F429’s)

      • I have to agree actually, there is the odd scattering of STM32 based documentation for the hobbyist but hardly a large amount on the internet. If the Maple project was still up, I’d recommend their forum for Maple based stuff. Otherwise, most of my questions get asked on the EEVBlog forum (with relation to the EEVBlog youtube channel!), the people there are extremely helpful and generally know a ton more than I do!

        Yeh, ST claim that switching can go up to 18MHz and other such extremely fast values but in practice, unless you’re writing directly to the registers, not in a loop, with fastest optimizations enabled, you’re not going to get a massively fast pin switch. Generally however, I’ve never needed pin switching at some immense speed which is fortunate.

        I’m actually in your shoes too! I’ve got the STM32F0 discovery, STM32F0 “disco”, STM32F407 discovery and the STM32F429 discovery which isn’t yet supported šŸ˜„ I can’t wait to have a go using the FMC!

        WRT to your while(1) vs for(;;), they generally get compiled to the same assembly anyway so I haven’t really tried!

  2. I just noticed a huge difference in the avr arm gcc. A factor of 4-6x loop speed increase moving to the for(;;) structure. for whatever the reason…. Give it a try if you have a chance and let me know if i’m just nuts. lol.

    • Well I found that quite interesting! I would’ve never though that changing from while(1) to for(;;) would give a performance increase.

      On the STM32F0 however, I had a go and here are my results:

      My main code was:
      #include
      #include

      GPIO_InitTypeDef G;

      int main(void)
      {
      SystemInit();
      RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);

      G.GPIO_Pin = GPIO_Pin_0;
      G.GPIO_OType = GPIO_OType_PP;
      G.GPIO_Mode = GPIO_Mode_OUT;
      G.GPIO_Speed = GPIO_Speed_Level_3;
      GPIO_Init(GPIOA, &G);

      while(1)
      {
      GPIO_SetBits(GPIOA, GPIO_Pin_0);
      GPIO_ResetBits(GPIOA, GPIO_Pin_0);
      }
      }

      GPIO Toggle speed:
      O0 Optimization – 615.4KHz
      O3 Optimization – 1.5MHz

      Changing the while(1) line to for(;;)
      GPIO Toggle speed:
      O0 Optimization – 615.4KHz
      O3 Optimization – 1.5MHz

      Unfortunately there was no change on this platform šŸ˜¦ I even disassembled the compiled code and it gave exactly the same results:

      19 GPIO_SetBits(GPIOA, GPIO_Pin_0);
      0800013a: movs r3, #144 ; 0x90
      0800013c: lsls r3, r3, #23
      0800013e: adds r0, r3, #0
      08000140: movs r1, #1
      08000142: bl 0x8000438
      20 GPIO_ResetBits(GPIOA, GPIO_Pin_0);
      08000146: movs r3, #144 ; 0x90
      08000148: lsls r3, r3, #23
      0800014a: adds r0, r3, #0
      0800014c: movs r1, #1
      0800014e: bl 0x8000454
      21 }
      08000152: b.n 0x800013a

      19 GPIO_SetBits(GPIOA, GPIO_Pin_0);
      0800013a: movs r3, #144 ; 0x90
      0800013c: lsls r3, r3, #23
      0800013e: adds r0, r3, #0
      08000140: movs r1, #1
      08000142: bl 0x8000438
      20 GPIO_ResetBits(GPIOA, GPIO_Pin_0);
      08000146: movs r3, #144 ; 0x90
      08000148: lsls r3, r3, #23
      0800014a: adds r0, r3, #0
      0800014c: movs r1, #1
      0800014e: bl 0x8000454
      21 }
      08000152: b.n 0x800013a

      Still a cool test though!

  3. hmmm well interesting.. I wonder if its something specific to the avr gcc.. but that is good to know.

    I usually just toggle with

    GPIOB->ODR ^= GPIO_Pin_1;

    will just toggle on every pass. Instead of needing to explicitly tell it to reset.
    Not sure if there is an advantage one way of the other. Just the way I do it.

    Thank you for taking the time to test that out too, I appriciate it!.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s