programming nRF51822 and integrating it on a PCB - firmware

I have a basic firmware question. I am looking to program a nRF51822 IC and integrate it on my own PCB. The evaluation kit seems to already have the IC soldered on it. Is it a way I can only program the nRF51822 and getting it ready to use elsewhere?

Get yourself one of these J-LINK LITE CortexM:
and hook up your connection header like this to your microcontroller (SWDIO, SWCLK, VCC and GND are the only ones needed):
.
Then, use Keil or nRFGo Studio to program your device.

You don't need J-Link at all. Any STLinkv2 board will work, like STM32 dev boards. But even nicer are these cheap Chinese programmers: http://www.aliexpress.com/item/FREE-SHIPPING-ST-Link-V2-stlink-mini-STM8STM32-STLINK-simulator-download-programming-With-Cover/32247200104.html
All you need to do is connect the Vcc, Ground, SDIO, and SWDCLK lines from your board/chip to the programmer, so make sure those pins are broken out and easy to get to.
There are some good instructions on how to do that here: https://github.com/RIOT-OS/RIOT/wiki/Board:-yunjia-nrf51822
I've built Linux workstations for workers on assembly lines to use with this method, and it just loops over and over for new boards. So they don't even need to touch the PC, they can just place a board on the jig or connect a header and it's all automatic.

You will need a programming device, such as a Segger Jlink. The eval kit has an on-board Segger programmer on it (that big chip with the Segger sticker on it).
I'm working through this process myself at the moment. I read somewhere that some people were successful at 'hacking' the eval kit, to bring the SWDIO and SWCLK over to their custom board but that really isn't the right way to go about it.
Instead, purchase an actual programmer and put a programming header on your custom circuit board.
While I am also still in the research phase here as well, it looks like there are 4-5 pins to connect from the programmer to your custom target board. The nRF documentation seems to be rather lacking in the definition of the programming setup, but look under the debugging category and take a look at Segger documentation as well.
If going into mass production there are ways to pre-program the chip before assembly, but I haven't had a chance to learn about that just yet.

Related

How to program hardware? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am an adept Visual Basic programmer. I wish to learn about how people program hardware. For example I have seen people create an LED watches, boxes etc. How do you achieve this? Can it be done using VB or Java? I have some experience in reading C, C++ code. I am only aware of IO in the C and C++ language.
Probably you are looking for a programmable microcontroller. If you have experience in C/C++/Java, checkout Arduino. Its chip is programmed using a C like language. This "How tos" page might help you get started. There are also some good books that will help you move forward:
Programming Interactivity.
Making Things Move DIY Mechanisms for Inventors, Hobbyists, and Artists
Wiring is a platform similar to Arduino.
Also have a look at the Forth programming language. There are lot of interesting "tiny
computers" that you can program with this rather unusual language. Here is a partial list:
Forth Inc
Greenarrays
Zilog Z8
PIC18Fxx2
Two famous Forth books:
Starting Forth
Thinking Forth (A classic in Software Engineering literature.)
how people program hardware
If by 'hardware' you mean a standalone device (an embedded system), then the process involves cross-compilation. Code for the device is written in some (high-level) language on a host PC, compiled, and converted to a form suitable for downloading onto the target device.
A cross-compiler generates executable code for a platform other than the one it is running on -- for example, an AVR cross-compiler will generate code for the AVR microcontroller, but the compiler runs on a PC. Universally, assembly and C are used, and to some extent C++, Java and Ada.
If by 'hardware' you mean some device connected to the PC via some port (serial, parallel, USB), then the programing involves interaction through that port, possibly needing a device driver as well.
Can it be done using VB or Java?
I'm not sure about VB (perhaps there are VB compilers for WinCE and its ilk). Java is used on more complex/larger embedded systems (eg. mobile phones), mainly to develop user applications for the device.
create an LED watches, boxes etc. How do you achieve this?
If you're interested in developing something like a LED watch, you need to learn how to program a microcontroller. At the least, you need two components: the microcontroller and some hardware which loads programs onto it (a programer). You may invest on a development board, or build one yourself. Naturally, you will also need the cross-compiler, and the sotware that interacts with the programer so that it can load code.
I'm partial to AVR, so I'd suggest that. Other options include PIC, some variant of 8051, PSoC1 and TI's MSP devices.
The AVR tool-chain is bundled in WinAVR, and it includes avr-gcc (cross-compiler frontend), avrdude (software that interacts with the programer hardware) and a C library (avr-libc) + a bunch of useful tools. Programing hardware can be as simple as DAPA/bsd to USB based ones (AVRISP, USBasp, Usbprog) etc.
Or, if your PC still has a parallel port, you can try to control say a set of LEDs using an application written in VB. Check http://www.lvr.com/parport.htm for details.
I would recommend starting out with something like an arduino, which is a good place to get started with programming close to the hardware. It's a prototyping board with some built-in leds and other things, depending on which model you get. You can use C/C++, or any other language which can be cross-compiled to a format which is compatible with the target hardware (ATMega microcontroller I believe on the arduino).
Check out: http://www.google.com/search?client=ubuntu&channel=fs&q=arduino&ie=utf-8&oe=utf-8
If you just want to connect something to the computer serial/parallel port and 'talk' to it, you can use most languages. In Visual Basic you'll need a dll to achieve this. Java may be able to do it too.
If you want to program a microcontroler chip, you'd best learn C, because this is the language used to program most of them, although some of them accept basic, java, processing and C++.
There are a number of basic stamps you can use to get your feet wet. parallax for example made their business on basic based embedded systems. If you want to move forward at that programming level you really need to learn C for the most coverage, and I highly recommend assembler as well, at least a few different instruction sets.
You might be interested in Gadgeteer. I got to play with a kit a few weeks ago, and it's amazing fun. You can't currently do VB, but you can do C# and VB is coming very soon.

AVR or PIC? Using MATLAB

well, i have to use a microcontroller that will decide the further course of action of a robot,that is continuously capturing images,with an on board camera and using MATLAB to process those images.(in a competition).Which microcontroller should i go for? The AVR series or PIC?i know to use 8051 microcontroller, but now i have to interface the AVR or PIC microcontroller with MATLAB. Can anybody help?
They're about equal in terms of power and options. You'll always be able to find what you need in either line of uC's. I prefer AVR for their better development tools and community support at places like AVRFreaks. You can find cheap boards and cheap programmers and tons of app notes for AVR. It's probably the easier to develop for. Plus, free C compiler.
Looking at the development process, I agree with Stephen Friederichs. The main question is: How do you communicate with MATLAB?
using a serial interface like a
COM port?
using ethernet?
compiling a
custom MATLAB function, which then
communicates with the
microcontroller?
...
My main point is, that the hardware decision has actually nothing to with MATLAB, because the communication will be quite the same whether you go for Microchip or Atmel.

Which IDE to use for ATMega32 micro controller coding

I am involved in a project which requires designing a mini rover (mars rover types). I am using ATMega32 micro controller. I have other hardware like DC motors, IR sensors etc. My query is that is there any IDE that I can use to code the micro controller? It must be user friendly since I am new to the concept of micro controller coding, and also it must have simulators. I did look it up on the net, but there are so many terms associated with it, that it confused me in the end. I think a simple IDE where I can write code, test it using simulator would be enough. Any suggestions?
I would try the Arduino's IDE: http://www.arduino.cc/en/Main/Software
It supports a lot of things such as building and debugging and interfacing with avrdude all from inside the IDE, so definitely a good one for embedded work, though I've never used it myself.
Also, while you are there, you may want to give the Wiring libraries a try. They are really nice for new people and are specifically for the ATMega32(I think).
There's no silver bullet.
Start here http://www.atmel.com/dyn/products/tools_v2.asp?family_id=607
Look for some videos on Youtube to learn.
Arduino is also a very good choice like Earlz wrote.
The best IDE to use would be ATMEL STUDIO 6. You can find it here http://www.atmel.com/microsite/atmel_studio6/. Also you would need a ICSP programmer to burn the .hex file into the Atmega32. Note: The ICSP programmer can also be use to program other atmega chips

Arm Board Bring Up

Can anybody tell me where I can find information related to How to Bringup any arm board? I am looking for an overview as I am novice in ARM related stuffs. Any link/document will do ...It will be gr8 help if i can look for a case-study
any arm based board can be considered..I am looking for just a case study...simple in few steps??
Every single ARM "board" will be different. Read the datasheet for the ARM chip you have, that should have a section near the start about booting. Also, read the datasheet about your board, as it made have flash/boot loaders on there. If there are no loaders on the board, you'll have to either set the jumpers for the ARM (if that type supoprts it) to read from external rom, or JTAG the initial boot code into it.
Basically: Read the datasheets. Programming a device like an ARM isn't your usual compile/run stratergy like most software, especially not in the first stage.
edit:
If you don't even have a board yet, try going for this one:
http://beagleboard.org/
It has and ARM on it (as well as a decent GPU).
Check the DLP-2232PB-G evaluation kit from FTDI. Looks great for newbies trying to get into microcontrollers, and it comes with everything you need. It's a PIC controller - not an ARM controller, but the easiest starting point that I've seen... and same basic methods of development.
I would start with any documentation the IC manufacturer may have on "getting started".
http://free-electrons.com/doc/porting-kernel.odp
This link gives a good overview of the bringup of the board with a CPU for which the linux support package is available.
Linux sources in arch/arm have mach-* which are cpus supported by Linux Kernel.
With in the mach-* dir, there are some board specific files that are board specific BSPs.
You can take the process elucidated in this article and try using in your case.
Check out the ok6410-h at http://www.arm9board.net/sel/prddetail.aspx?id=348&pid=200
Quit a nice kicking-start kit coming with everyting you would ever need: documentations, source code, example programs.
recommendable for both newbies and experienced.

How do I get input from an XBox 360 controller?

I'm writing a program that needs to take input from an XBox 360 controller. The input will then be sent wirelessly to an RC Helicopter that I am building.
So far, I've learned that this can be done using either the XInput library from DirectX, or the Input framework in XNA.
I'm wondering if there are any other options available. The scope of my program is rather small, and having to install a large gaming library like DirectX or XNA seems like excessive. Further, I'd like the program to be cross platform and not Microsoft specific.
Is there a simple lightweight way I can grab the controller input with something like Python?
Edit to answer some comments:
The copter will have 6 total propellers, arranged in 3 co-axial pairs. Basically, it will be very similar to this, only it will cost about $1,000 rather than $15,000. It will use an Arduino for onboard processing, and Zigbee for wireless control.
The 360 controller was selected because it is well designed. It is very ergonomic and has all of the control inputs needed. For those familiar with helicopter controls, the left joystick will control the collective, the right joystick with control the pitch and roll, and the analog triggers will control the yaw. The analog triggers are a big feature for the 360 controller. PS and most others do not have them.
I have a webpage for the project, but it is still pretty sparse. I do plan on documenting the whole design though, so eventually it will be interesting.
http://tricopter.googlecode.com
On a side note, would it kill Google to have a blog feature for googlecode projects?
I would like the 360 controller input program to run in both Linux and Windows if possible. Eventually though, I'd like to hook the controller directly to an embedded microcontroller board (such as Arduino) so that I don't have to go through a computer, but its not a high priority at the moment.
It is not all that difficult. As the earlier guy mentioned, you can use the SDL libraries to read the status of the xbox controller and then you can do whatever you'd like with it.
There is a SDL tutorial: http://sdl.beuc.net/sdl.wiki/Handling_Joysticks which is fairly useful.
Note that an Xbox controller has the following:
two joysticks:
left joystick is axis 0 & 1;
left trigger is axis 2;
right joystick is axis 3 & 4;
right trigger is axis 5
one hat (the D-pad)
11 SDL buttons
two of them are joystick center presses
two triggers (act as axis, see above)
The upcoming SDL v1.3 also will support force feedback (aka. haptic).
I assume, since this thread is several years old, you have already done something, so this post is primarily to inform future visitors.
PyGame can read joysticks, which is what the X360 controller shows up as on a PC.
Well, if you really don't want to add a dependency on DirectX, you can use the old Windows Joystick API -- Windows Multimedia -> Joystick Reference in the platform SDK.
The standard free cross plaform game library is Simple DirectMedia Layer, originally written to port Windows games to Unix (Linux) systems. It's a very basic, lightweight API that tends to support the minimal subset of features on each system, and it has bindings for most major languages. It has very basic joystick and gamepad support (no force feedback, for example) but it might be sufficient for your needs.
Perhaps the Mono.Xna library has added GamePad support, which would provide the cross platform functionality you were looking for:
http://code.google.com/p/monoxna/
As far as the concerns about the library being too heavy weight, sure, for this option it may be true ... however, it could open up opportunities to do some nice visualization in the future.
disclaimer: I'm not familiar with the status of the mono xna project, so it may not have added this feature yet. But still, 'tis an option :-)