Dipcortex & SolderBridge Example Code

Talk about our 40 Pin Dip ARM Cortex M3 / M0 Here

Dipcortex & SolderBridge Example Code

Postby Carl-SolderSplash » Sat May 04, 2013 2:05 pm

I've just started a github repository for a library of example code for both the Dipcortex and SolderBridges

I shall add more examples over time, you can grab the latest version from here. Click the Zip/Cloud button to grab a zipped download.

You will need NXP's LPCXpresso IDE for these examples

Download the project from github as a zip,
Open LPCXpresso, locate the quickstart panel on the left choose import projects. Select project archive and select your download zip file.
You should then see a list of projects available, select them all and click finish.

You will now have imported all of the projects and they should be listed on the left in the project explorer.

Projects are setup to build .bin files which are created in the projects debug/release directories, these can be used with the Mass storage device bootloaders.

Started off with the most simple example of toggling an output using the systick ( a timer interrupt ). Open src/main.c to see the code.
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: Dipcortex & SolderBridge Example Code

Postby Dave » Thu May 09, 2013 10:50 am

I've been having a play around with this but don't fully understand what's going on.

Is there any chance you could show a tutorial to help get started?
Dave
 
Posts: 58
Joined: Fri Mar 29, 2013 12:48 am

Re: Dipcortex & SolderBridge Example Code

Postby Carl-SolderSplash » Thu May 09, 2013 10:12 pm

Hi Dave,

Pushed a few more changes to github, I had missed a few files for the LPC13.

This page http://www.soldersplash.co.uk/products/ ... -lpc-gpio/ explains how to go about setting up a GPIO pin and using it.

For the git hub example have a look at src/main.c there are 2 functions SysTick_Handler and main.

Main

  • Configures the timebase of the systick, which i have chosen 1ms
  • Enables the GPIO peripheral ( the chip powers up with it disabled )
  • Sets a pin up as an an output
  • And then stays in the while loop forever sleeping whilst being intermittently interrupted
The SysTick_Handler function has the code that is executed every 1ms, here we

  • Increment the msCounter until it reachs 1000 == 1 second. (Alternatively Could just adjust the systick freq to only interrupt once a second)
  • Once it has we add 1<<13 in to the LPC_GPIO->NOT[0] register.
  • 1<<13 is 1 shifted left 13 times, effectively creating a value where the only bit set is BIT13.
The NOT register is a GPIO register that will toggle the related IO pin to the value written to it. There are 2 NOT registers for the 2 GPIO ports 0 and 1, the CMSIS exposes this as an array. So every time we write our value with only BIT13 set to NOT[0] it we only toggle BIT13 on Port 0.

The NOT register is a time saving method of updating a GPIO pin.
See http://www.nxp.com/documents/user_manual/UM10462.pdf Chapter 9.5.3.9 GPIO port toggle registers

Another way of acheive the same outcome would be to read the value on the port and modify the bit we want and then write it back. Or we could use a software flag that decides the next state of the pin.

Getting some screen recording software sorted out, I hope to record a video showing git hub download, import, code run through and the result. Hope this helps for now.
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: Dipcortex & SolderBridge Example Code

Postby Dave » Thu May 09, 2013 11:56 pm

I'm sure I'll get there in the end Carl. I'll try to make some time to go through this over the weekend.

While playing around with LPCXpresso I did find src/main.c although didn't fully understand the code. What is really confusing me though is what to actually do with the code. Does it need uploading to the SplashBase or DipCortex and if so how. Is this done from LPCXpresso or is LPCXpresso just for writing and testing the code.

Thanks for your help Carl.
Dave
 
Posts: 58
Joined: Fri Mar 29, 2013 12:48 am

Re: Dipcortex & SolderBridge Example Code

Postby Carl-SolderSplash » Fri May 10, 2013 7:00 am

The video will help then ...

Once you have imported it in to LpcXpresso you build each project by right clicking on it and selecting build. Build the cmsis projects first.
Then the blinky.

In your debug directory of the project, once built, you will find a .bin file this is the compiled firmware that will need dragging and dropping on to the dip cortex drive in boot loader mode.

If you make changes and it fails to build there is a window at the bottom called problems that tells you what issues you have and where they are in code.
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: Dipcortex & SolderBridge Example Code

Postby Dave » Fri May 10, 2013 8:09 am

That makes it a whole lot clearer. Looking forward to the video.

Keep up the good work. You're doing a great job Carl.
Dave
 
Posts: 58
Joined: Fri Mar 29, 2013 12:48 am

Re: Dipcortex & SolderBridge Example Code

Postby Carl-SolderSplash » Mon May 13, 2013 7:15 pm

not sure if you spotted it yet, but the video is now online. Let me know if it helps
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: Dipcortex & SolderBridge Example Code

Postby Dave » Mon May 13, 2013 11:47 pm

I had a look at the video this morning Carl and it helps a lot. I haven't had time to put it into practice yet but will do so when I get up in the morning.
Dave
 
Posts: 58
Joined: Fri Mar 29, 2013 12:48 am


Return to DipCortex M3/M0

Who is online

Users browsing this forum: No registered users and 3 guests

cron