SAM C first project - Page 1
Forum section: electronics / general

author: Simon
author_rank: Unknown
timestamp: July 11, 2019, 08:33:08 pm
content: Right, got a SAM C 21J explained board. Fired up MPLAB and started a "blank project" and oh... I have two files made by microchip that are full of code one has a bunch of names of things that it itself doen not recognise. Can i just scrap these and get on with my own thing?

author: malagas_on_fire
author_rank: Frequent Contributor
timestamp: July 11, 2019, 09:10:22 pm
content: From the looks of the manual they start with download Atmel Studio 7... on page 6-http://ww1.microchip.com/downloads/en/DeviceDoc/70005318A.pdfEdit; If this is you're board...

author: malagas_on_fire
author_rank: Frequent Contributor
timestamp: July 11, 2019, 10:21:33 pm
content: See if this helps:https://www.microchip.com/forums/m1096683.aspx

author: Simon
author_rank: Unknown
timestamp: July 12, 2019, 06:34:58 am
content: Quote from: malagas_on_fire on July 11, 2019, 10:21:33 pmnot really. I have started a blank project only to find it populated with some unexplained code. If I wanted that crap i would have used the graphical interface woo woo just to do a proper job of having a load of useless and uninteligible code spat at me. I just wanted a start from scratch barebones project. Also the pint of the SAM C device, it's an ARM but a simple one that is easy enough to just write code for without resorting to undocumented middleware crap.

author: westfw
author_rank: Super Contributor
timestamp: July 12, 2019, 07:46:22 am
content: Maybe take a look athttps://github.com/WestfW/SAMD10-experiments?It's been a while, and ... it looks like I started with an "example project" and cut things out rather than starting from scratch, but there are a bunch of notes on dealing with a bunch of the Atmel Annoyances.In particular, Atmel considers the core CMSIS defintions to be part of ASF, so you probably want to do at least some partial setup of ASF and "#include <asf.h>" even if you're not planning on using any of the ASF library functions.

author: Simon
author_rank: Unknown
timestamp: July 12, 2019, 07:49:52 am
content: Put it this way, MPLABX is complaining about it own code! loads of the variables or whatever they are are in error, way to go microchip, start a "blank" project with a load of code you yourselves have problems with.

author: JPortici
author_rank: Super Contributor
timestamp: July 12, 2019, 08:10:52 am
content: I tried, just for kicks with my ATSAMC21 XPLAINED board.I created a blank project and it was blank.I added a c file (not a "c main file") and it was just an empty file, that's it.I coded something simple, compile, done.Your experience may vary though, i used MPLAB X 5.15 and XC32 V2.15, support is still marked as beta. Maybe in 5.20 they changed things, but i won't try it.5.20 is a bugged pile of garbage, incompatible with projects from the previous version.Unfortunately i don't know when i'll have time to do something more meaningful to help you..

author: cv007
author_rank: Frequent Contributor
timestamp: July 12, 2019, 08:12:39 am
content: >populated with some unexplained codeI created a project in mplabx (5.15) for a C21Jsomething, created the standard/mostly empty newmain.c file, and using xc32 v2.20. I can't even compile without error, as it cannot find core_cm0plus.h, and still cannot find it when I add the directory in include settings. I don't know what is going on. I also have the arm gcc compiler added to the build tools, and I would guess that probably works fine but didn't want to take the time to also sort out adding the startup file, linker script, include directories, etc.In the other thread, Alex showed a link to his github directory for sam parts. He also has a command line programmer app that may work also. I have a samd10xplained project on github, but it is in c++ and probably shouldn't be seen anyway, so will not link to it here. To make mine work I needed the atmel dfp pack, the cmsis pack, the arm gcc compiler, and the programmer app from Alex. I then wrote my own script to do the stuff a makefile does- clean,compile,create lss/hex/bin, program, gitupdate, etc.me->But whether you use xc32 or arm gcc, you may have to fiddle around a little to make it work right.you->So why will i have to fiddle to get the compiler to work? if the compiler works for the chip and the IDE uses it what is the problem?

author: legacy
author_rank: Super Contributor
timestamp: July 12, 2019, 08:57:01 am
content: These things are made with the RAD philosophy in mind.RAD stands for _R_apid _A_pplication _D_evelopment.so, if you find that Microchip's approach annoying,don't even try the Infineon's DAVE! It's even worse.

author: malagas_on_fire
author_rank: Frequent Contributor
timestamp: July 12, 2019, 08:57:38 am
content: Quote from: Simon on July 12, 2019, 06:34:58 amMy point is to create a simple project on the atmel studio 7 eg a led blinking or something else and import into MPLABX, since the support to SAM boards is still in progress. Yesterday i tried to create a project with that processor on MPLAX 5.20 for linux x64 and i couldn't even install CMSIS and DPF on the packs window..... so really premature.to import create a new project and select import atmel studio project.Also beware to install the ARM toolchain:https://www.microchip.com/mplab/avr-support/avr-and-arm-toolchains-c-compilers