Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Netduino Plus 2 native c firmware upload


  • Please log in to reply
19 replies to this topic

#1 mattih

mattih

    New Member

  • Members
  • Pip
  • 2 posts

Posted 13 December 2012 - 10:41 PM

How do you upload custom firmware to the Netduino Plus 2? I want to write my own c/c++ app and bootloader. From what I've read on here about the Netduino Plus you could short 3.3V to erase and then use sam-ba to upload new firmware however sam-ba doesn't seem to work for me with the Plus 2. Is there a different method for the Plus 2 vs the Plus??

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 13 December 2012 - 11:37 PM

Hi mattih,

Here are the three most common options for uploading custom C/C++ code to Netduino Plus 2 or Netduino Go:
  • DfuSe Demo -- for flashing DFU files (converted from BIN or Motorola HEX) via USB much like SAM-BA.
  • STM32 ST-Link Utility -- for flashing BIN or HEX files via JTAG/SWD.
  • IAR or other IDE -- for deploying and debugging apps directly via JTAG/SWD.
BTW, welcome to the Netduino community!

Chris

#3 mattih

mattih

    New Member

  • Members
  • Pip
  • 2 posts

Posted 14 December 2012 - 02:06 AM

Chris, thanks for your response! Very helpful. I think i will try the dfu method for now but I'll probably order a st-link for future use. Excited to get something going here.

#4 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 14 December 2012 - 03:39 AM

you dont need the st-link hardware! its a (free!) software. netduino doesent expose the swd pins for the hardware piece iirc

#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 14 December 2012 - 08:26 AM

Hi NooM,

you dont need the st-link hardware! its a (free!) software. netduino doesent expose the swd pins for the hardware piece iirc

Just FYI, both Netduino Go and Netduino Plus 2 expose SWD via the Cortex Debug Port (MiniJTAG header).

Chris

#6 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 14 December 2012 - 09:48 AM

thx for the info, good to know

#7 ziggurat29

ziggurat29

    Advanced Member

  • Members
  • PipPipPip
  • 244 posts

Posted 14 December 2012 - 02:04 PM

Just FYI, both Netduino Go and Netduino Plus 2 expose SWD via the Cortex Debug Port (MiniJTAG header).

speaking of which, does someone know where I can get the tiny pin header for this port? for a couple bucks? I have a jtag interface and cable for that header coming, but I will still need to solder on the pin header to the board.
-dave

#8 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 14 December 2012 - 02:15 PM

For example FCI 20021111-00010T4LF (at Mouser).

#9 OShoot

OShoot

    New Member

  • Members
  • Pip
  • 1 posts

Posted 04 January 2013 - 02:17 PM

Does a document or forum exist on the process of erasing and downloading firmware such that the  the Netduino Plus 2 may be programmed using Native C/C++ code. (ie using GCC, Borland C/C++, Visual Studio express C/C++etc.

 

Sorry as a Netduino newbee I would appreciate any detailed help.

  Thankee O'Shoot



#10 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 04 January 2013 - 03:52 PM

Hi dave,
speaking of which, does someone know where I can get the tiny pin header for this port? for a couple bucks? I have a jtag interface and cable for that header coming, but I will still need to solder on the pin header to the board.
These will also work:
http://www.amazon.co...=A15S1YSPRYIXOQ

Chris

#11 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 04 January 2013 - 10:48 PM

Hi O'Shoot,
Does a document or forum exist on the process of erasing and downloading firmware such that the  the Netduino Plus 2 may be programmed using Native C/C++ code. (ie using GCC, Borland C/C++, Visual Studio express C/C++etc.
The easiest thing to do is to connect to the Netduino Plus 2 using MiniJTAG. Then you can deploy and debug directly from your native code development environment. Or upload BIN/HEX files using "STM32 ST-Link Utility." Alternatively, you can use "DFU File Manager" to convert .BIN or .S19 (HEX) files into .DFU files, and then use "DfuSe Demonstrator" to flash those .DFU files to your board. ST publishes the DFU file layout as well...so that process can be largely automated. Does that help get you started? Chris

#12 apokryphus

apokryphus

    Member

  • Members
  • PipPip
  • 12 posts

Posted 22 March 2013 - 06:44 PM

hey,

 

i currently managed it to build, deploy and fully debug a stm32f4 discovery eval board via visual studio with c-code.

i guess the st-link V2 debugger i ordered will arrive on Thursday next week.

When i have it by my side, i will try to deploy my very basic blinky code on the net+2 and will report the result here.

i the meanwhile and in case you also own a stm32f4 discovery, i setup up a step by step tutorial here - you maybe like to test it by yourself...

 

regards



#13 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 22 March 2013 - 07:32 PM

...stm32f4 discovery eval board ...i guess the st-link V2 debugger i ordered

 

I am not sure this is relevant, but ST-LINK/V2 included on the Discovery board can be used to debug and program other micros/boards via SWD, it is just needed to remove those two jumpers of CN3 connector (ST-LINK/DISCOVERY selector).



#14 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 22 March 2013 - 07:50 PM

I am not sure this is relevant, but ST-LINK/V2 included on the Discovery board can be used to debug and program other micros/boards via SWD, it is just needed to remove those two jumpers of CN3 connector (ST-LINK/DISCOVERY selector).

 

i told him in the chat :(



#15 apokryphus

apokryphus

    Member

  • Members
  • PipPip
  • 12 posts

Posted 22 March 2013 - 07:52 PM

oh yes, you are right - but i am also waiting for the1,27 mm pin connectors  <_<



#16 apokryphus

apokryphus

    Member

  • Members
  • PipPip
  • 12 posts

Posted 26 March 2013 - 10:47 AM

Delivered and soldered...

I was able to build and deploy via Visual Studio 2012 and VisualGDB a small blinky written in C to the NET+2 - the program is running fine at all, but a lot of work have probably to be done now, since it is a bigger workaround the reflash/debug it again.

 

The Problem:

When i deploy via ST-Link V2 and the TI ADA2 converter everything works fine but and i even can set some breakpoints in main.c - another breakpoint in a called function is not being triggered - but then the NET+2 disappears.

 

I have to flash the *.hex via the ST32 ST-Link Utility to get it back in either bootloader or standard mode.

 

I really could need some help - if anybody wants to investigate, please write me a PM.



#17 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 26 March 2013 - 12:25 PM

The Problem:
When i deploy via ST-Link V2 and the TI ADA2 converter everything works fine but and i even can set some breakpoints in main.c - another breakpoint in a called function is not being triggered - but then the NET+2 disappears.
 
I have to flash the *.hex via the ST32 ST-Link Utility to get it back in either bootloader or standard mode.

 
I am not sure I understand that correctly, but "NET+2 disappears" is not wrong, unless you have implemented .NET MF USB transport in your C/C++ application. I would have to see the linker settings (base address) for your native application to be sure, but usually it is flashed at the beginning of the flash memory area, so it basically overwrites .NET MF bootloader.
 
You should be able to flash and debug the native application repeatedly with ST-LINK/V2, if breakpoints do not work make sure you are building 'debug' configuration (i.e. debugging information is included and symbols available). 
 
You should be able to get Netduino Plus 2 into bootloader mode by recycling the power while holding down the onboard switch. Also, ST-LINK/V2 can reset and halt the CPU core, there are appropriate commands available in ST-Link Utility menu; I assume they are also available in the IDE during debugging session.
 
I have no experience with GDB, so I don't know whether such problems can be caused by it (perhaps limited support for ST-LINK/V2?), but I use ST-LINK/V2 extensively and I have not had any problems with it...

#18 apokryphus

apokryphus

    Member

  • Members
  • PipPip
  • 12 posts

Posted 26 March 2013 - 12:37 PM

Hey CW,

 

thank you for your response.

Yes, i guess you are right, i am probably overwriting the tinyclr when writing my code to 0x08000000 - since this is the address i figured out from the tinyclr.hex file.

 

as i said, i am new to this business and learn it by myself via trial and error, therefore your help is very much appriciated. =)



#19 apokryphus

apokryphus

    Member

  • Members
  • PipPip
  • 12 posts

Posted 29 March 2013 - 10:26 AM

Finally figured out - but still now knowing why - what the solution to the debugging problem is - i just have to toggle a different pin than the onboard LED.

Of course the clr is still overwritten (Base address 0x08000000) and therefore the Netduino+2 is not available as an USB-Device (but still in Bootloader mode) but the debugger is now always resetting and loading the file to the net+2 and jumps directly to the routines or whereever the breakpoints are.

 

However i now can start to learn C/C++ on that tiny device and use hopefully the whole bench of Arduino Shields ... :D



#20 BortMechanic

BortMechanic

    New Member

  • Members
  • Pip
  • 1 posts

Posted 26 April 2013 - 10:41 AM

Hello everybody.

 

There are many useful topics described in this thread. And it would be great if someone of you guys will publish something like step-by-step tutorial about writing (and deploying and maybe debugging) a native code application for Netduino (for example Blinking Led App). I think the Netduino community will be happy to have such tutorial (personally I will be happy for sure :) ). Dispite the fact, that .NET MF is great (simple and friendly for c# develpers), but performance is critical for many microcontroller tasks. So I think the ability to write native code applications is a "must have" feature of any microcontroller platform.

 

Thanks in advance.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.