Jump to content
pokmo

Porting Arduino code to MSP

Recommended Posts

Hi

 

I have an Arduino sketch that I'd like to port to the MSP. I know I could use Energia, but I was hoping to use a better toolchain for better optimisation. The sketch takes readings from a gyro and controls a BLDC motor - like a stabiliser. I haven't made up my mind on which MSP430 to use though. Does anyone know how I could approach to the porting? Should I just get the most 'performant' MSP430 and ensure the code runs first? Should I jump straight into CCS?

 

Any thought would be appreciated.

 

Thanks

Share this post


Link to post
Share on other sites

Hi @@pokmo

 

You will of course get faster and tighter code by rewriting the Arduino sketch for direct access to the underlying hardware regardless of the toolchain / IDE / compiler.

 

However, if you are going to port Arduino code, as opposed to rewriting it, then it would be best to use Energia.  The MSP430G5529 is a good choice.  It has lots of resources, runs at 25 MHz, has USB, and the Energia implementation is mature. CCS can be used with Energia on the F5529.  With regards to porting, try compiling the code in the Energia IDE first and see what errors occur.  Often it will work with minimal changes, maybe limited to pins, but if there is a lot of hardware specific stuff in the Arduino code then it is sometimes better just to rewrite it.

 

You specifically state the MSP430, but the MSP432 or Tiva could also be used.

Share this post


Link to post
Share on other sites

@@pokmo

 

As far as jumping straight into CCS it depends on your priorities. If you're wanting to dive into writing code right away. Then perhaps CCS would be the best way to go. If you do have time to mess around with toolchain setup. You can use the toolchain that comes with Energia, etiher stand alone from the cmdline, or you can plug it into another IDE like code::blocks.

 

Personally I do not like CCS, but that's my own hangup. But I've read that TI's compiler is the better at optimization. The gcc toolchain that does come with Energia is also very good for MSP430G2* processors, but I'm not sure if it's solid or not for the rest of the MSP430's or not.

 

Another consideration would be to use one of TI's Cortex M4 ARM based launchpads. But you know what the msp430G2* may even be enough "horsepower" for your project.

 

Also I suppose another factor to consider would be what exactly do you mean by "optimization" ? CCS' compiler I've read is a bit better at code optimization. But if you mean the fact that Energia seems to have to tendency to pull in everything but the kitchen sink when you compile . . . that can be fixed.

Share this post


Link to post
Share on other sites

Here's a BLDC project that I learned quite a bit from.....    see the cut / paste at the bottom of this message .....

(author = @lgbeno)

 

The project uses CCS, a '2553 at 16MHz, and the code is very modular, the documentation (including use of the async port to annotate the scope traces) is cool.

 

Regarding your questions, though :

 

My own view is that CCS is a great IDE, has a solid compiler and the memory / HW register / variables mods one can do while the test processor is halted can really save a lot of time during debugging.  

CCS, along with Energia is a formidable tool for me for doing small projects and actually finishing them.

 

Best of luck, 

 

 

======  search the forum on BLDC  ========

 

 

Posted 10 July 2013 - 05:18 AM

Cool project, I did something very similar as well!

https://github.com/lgbeno/BLDC-Booster
 
======

Share this post


Link to post
Share on other sites

Whlie new to Energia, I've coded for the '430 with both IAR and CCS using the "traditional" main() non-OOP approach.  It's fairly straight-forward to write in C, but is a massive departure, conceptually, from using tools like the Arduino or Energia OO libraries, which strive to hide the lower-level implementations.  Both of these tools do a phenomenal job of presenting an high-level, seemingly simple way to control the underlying technology.  If there is a downside, it's that they are so effective at hiding the complexities, and perhaps, the true capabilities of the underlying devices.

In particular, the '430, with a well-designed and implemented system, can achieve incredible battery life by spending 95 - 99% of its time sleeping, wiating for an interrupt to which it needs to respond. Often, those responses can be handled with comparatively few cpu clock ticks.  However, I don't see a gyro-BLDC system spending much, if any, time in LPM4, though the gyro inputs might meet the needs for a hardware interrupt (required to wake from LPM4).

 

As to IDEs, I strongly prefer IAR over CCS. However, the 4K kickstart version from IAR is viable for only small projects (unless you want to dive into assembler, which didn't used to have a code-size limit).  The 16K limited CCS is much more functional, but personally, I hate the UI.  That said, I was able to afford a license for an full version of CCS, which was just not possible to do with IAR.  As a hobbyist I could not justify $thousands, even for a 40% discounted version...

I'm using a blend of Energia/CCS (probably badly) to do some rapid prototyping/proof of concept work.  However, the final code will use a more traditional main() and while it may "loop" it will be a wake from LPM, do some work, go back to sleep loop, and be object-based if I'm smart enough to get my head wrapped around OOD/OOP again...

As noted by others, you can do smaller projects, and effectively prototype with Energia/CCS.  At this point I may start with Energia, or import an existing sketch to get a handle on a sensor/430 implementation, but I spend 99% of my time in CCS.  HTH

 

Bob

Share this post


Link to post
Share on other sites

As long as a library relies on the Wiring / Arduino framework, a library designed for Arduino should work with Energia with minimal adaptation.

 

The Wiring / Arduino framework acts as a hardware abstraction layer, especially for the UART, SPI and I

Share this post


Link to post
Share on other sites

 

As long as a library relies on the Wiring / Arduino framework, a library designed for Arduino should work with Energia with minimal adaptation.

 

The Wiring / Arduino framework acts as a hardware abstraction layer, es specially for the UART, SPI and I

Share this post


Link to post
Share on other sites

 

As to IDEs, I strongly prefer IAR over CCS. However, the 4K kickstart version from IAR is viable for only small projects (unless you want to dive into assembler, which didn't used to have a code-size limit).  

 

 

Hi Bob,

 

I'm looking at trying the IAR 4K Kickstart version as well. I have no experience in CCS or IAR. Could CCS code be compiled on IAR? I've heard many good things about IAR, which is why I'm thinking of giving it a try.

Share this post


Link to post
Share on other sites

Could you provide a link to the sketch you are talking about?

 

Sure. Here it is:

#include <SPI.h>long recOmegaD = 0;
long omegaD = 0;
long thetaM = 0;
long recMicros = 0;
long recOmegaDa = 0;
long omegaDa = 0;
long thetaMa = 0;
long deg1000 = 0;
int variPwm = 0;
byte phase = 0;
int rz, rza, dRz, dRza;
long R, Ra;


const int motorPin1 = 3;
const int motorPin2 = 9;
const int motorPin3 = 10;


const long L1000 = 51429;
const int nLnT1000 = 2140;
const int  LnT1000 = 4291;
const int  LnLvl10 = 390;
const long slope1000 = 41245;


void L3GD20_write(byte  reg, byte val) {
  digitalWrite(5, LOW);  
  SPI.transfer(reg);
  SPI.transfer(val);
  digitalWrite(5, HIGH);    
}


byte L3GD20_read(byte reg) {
  byte ret = 0;
  digitalWrite(5, LOW);  
  SPI.transfer(reg | 0x80);
  ret = SPI.transfer(0); 
  digitalWrite(5, HIGH);   
  return ret;
}


void L3GD20a_write(byte  reg, byte val) {
  digitalWrite(6, LOW);
  SPI.transfer(reg);
  SPI.transfer(val);
  digitalWrite(6, HIGH);  
}


byte L3GD20a_read(byte reg) {
  byte ret = 0;
  digitalWrite(6, LOW);  
  SPI.transfer(reg | 0x80);
  ret = SPI.transfer(0); 
  digitalWrite(6, HIGH); 
  return ret;
}


void setup () {
  Serial.begin(9600);


  pinMode(motorPin1, OUTPUT); 
  pinMode(motorPin2, OUTPUT); 
  pinMode(motorPin3, OUTPUT); 
  pinMode(5, OUTPUT);  
  pinMode(6, OUTPUT);  
  digitalWrite(5, HIGH);   
  digitalWrite(6, HIGH);  
  SPI.begin(); 
  SPI.setBitOrder(MSBFIRST); 
  SPI.setDataMode(SPI_MODE3); 
  SPI.setClockDivider(SPI_CLOCK_DIV2); 
  L3GD20_write(0x20, B11001111); 
  L3GD20_write(0x23, B00000000); 
  L3GD20a_write(0x20, B11001111); 
  L3GD20a_write(0x23, B00000000); 


  TCCR1B &= B11111000;
  TCCR1B |= B00000001;
  TCCR2B &= B11111000;
  TCCR2B |= B00000001;


  calibrate();
  delay(50);
  recMicros = micros(); 
}




void loop () { 
  chkAndCtl();
  calcPwms();
  if ( phase == 1 ) {
    analogWrite(motorPin1, variPwm);
    analogWrite(motorPin2, 255);
    analogWrite(motorPin3, 0);
  }
  if ( phase == 2 ) {
    analogWrite(motorPin1, 255);
    analogWrite(motorPin2, variPwm);
    analogWrite(motorPin3, 0);
  }
  if ( phase == 3 ) {
    analogWrite(motorPin1, 255);
    analogWrite(motorPin2, 0);
    analogWrite(motorPin3, variPwm);
  }
  if ( phase == 4 ) {
    analogWrite(motorPin1, variPwm);
    analogWrite(motorPin2, 0);
    analogWrite(motorPin3, 255);
  }
  if ( phase == 5 ) {
    analogWrite(motorPin1, 0);
    analogWrite(motorPin2, variPwm);
    analogWrite(motorPin3, 255);
  }
  if ( phase == 6 ) {
    analogWrite(motorPin1, 0);
    analogWrite(motorPin2, 255);
    analogWrite(motorPin3, variPwm);
  }
}


void calibrate() {
  analogWrite(motorPin1, 217);
  analogWrite(motorPin2, 0);
  analogWrite(motorPin3, 255);
  delay (3000);
  R = 0;
  Ra = 0;
  for  (long i = 0 ; i < 4000 ; i++ ){
    if ( i > 1000 ) {
      rz = ( (L3GD20_read(0x2D) << 8) | L3GD20_read(0x2C) );
      R = R + rz;
      rza = ( (L3GD20a_read(0x2D) << 8) | L3GD20a_read(0x2C) );
      Ra = Ra + rza;
      delayMicroseconds( 25 );
    } 
  }
  dRz = R / 750; dRza = Ra / 750;
}


void chkAndCtl() {
  R = 0;
  Ra = 0;
  for  (int i = 0 ; i < 4 ; i++ ) {
    rz = ( (L3GD20_read(0x2D) << 8) | L3GD20_read(0x2C) );
    R = R + rz;
    rza = ( (L3GD20a_read(0x2D) << 8) | L3GD20a_read(0x2C) );
    Ra = Ra + rza;
    delayMicroseconds( 25 );
  }
  omegaD  = ( R  - dRz  ) * 0.025;
  omegaDa = ( Ra - dRza ) * 0.025;
  recMicros = micros() - recMicros;
  thetaM = thetaM + ( (omegaD+recOmegaD)/20 ) * recMicros;
  thetaMa = thetaMa + ( - (omegaDa+recOmegaDa)/20 ) * recMicros; // Line A
  deg1000 = thetaM / 1000 - 1*omegaDa * recMicros /500 + 1*thetaMa/1000;// Line B
  recMicros = micros(); 
  recOmegaD = omegaD; 
  recOmegaDa = omegaDa;
}


void calcPwms() {
  int degPwm1000 = deg1000 % 8571;
  if ( degPwm1000 < 0 ) { degPwm1000 = degPwm1000 + 8571; }
  long linePwm = ( LnLvl10 + ( slope1000 * degPwm1000 ) / 100000 + 5 ) / 10; 
  long degNL1000 =abs( degPwm1000 - LnT1000 - nLnT1000 );
  long nLinePwm = 255 - ( ( - 2935 * (sq( sq(degNL1000)/1000 ) /1000 )
  + 8413 * ( (sq(degNL1000)/1000 ) * degNL1000 /1000 )
  - 11421 * (sq(degNL1000)/1000 ) + 32929 * ( degNL1000 )
                            ) / 100000 + 5
                          ) / 10;
  int pwmShape = 0;
  if ( degPwm1000 < LnT1000 ) { pwmShape = linePwm; }
  else { pwmShape = nLinePwm; } 


  int dDegPwm1000 = deg1000 % 17143;
  if ( dDegPwm1000 < 0 ) { dDegPwm1000 = dDegPwm1000 + 17143; }
  if ( dDegPwm1000 < 8571 ) { variPwm = 255 - pwmShape; }
  else { variPwm = pwmShape; }




  long shftDeg1000 = ( deg1000 + L1000/2 + nLnT1000 ) % L1000;
  if ( shftDeg1000 < 0 ) { shftDeg1000 = shftDeg1000 + L1000; }


  phase = 0;
  if ( shftDeg1000 < 8571 ) { phase = 1; }
  else {
    if ( shftDeg1000 < 17143 ) { phase = 2; }
    else { 
      if ( shftDeg1000 < 25714 ) { phase = 3; }
      else {
        if ( shftDeg1000 < 34286 ) { phase = 4; }
        else { 
          if ( shftDeg1000 < 42857 ) { phase = 5; }
          else { phase = 6; } 
        }
      } 
    }
  }
}

Share this post


Link to post
Share on other sites

It seems like the only trouble might be the timer register code.

TCCR1B &= B11111000;
TCCR1B |= B00000001;
TCCR2B &= B11111000;
TCCR2B |= B00000001;

The rest should just port over.  Take a look at the TIMERA examples to see how to approach that code.

 

-rick

Share this post


Link to post
Share on other sites

Hi Bob,

 

I'm looking at trying the IAR 4K Kickstart version as well. I have no experience in CCS or IAR. Could CCS code be compiled on IAR? I've heard many good things about IAR, which is why I'm thinking of giving it a try.

Hi Rick,

Usually the example code, as posted, will compile under either.  TI's examples have the appropriate defines to handle the differences in header file definitions and, in some cases, vendor spedific intrinsics. 

As to my preference, it may relate more to my starting with IAR rather than CCS some years back.  So, IAR is in "old friend" comfort mode.  But the 4k limit is pretty intrusive, and IAR seems to have zero interest in the hobbyist/maker market with their pricing structure. So for any of the more complex stuff one might pull in from a published/ported sketch, it's likely it won't compile under IAR. 

So, as one of my projects has grown in complexity and code size, I had to step away from IAR.  The price comparison was pretty much a no-brainer. CCS was $500, IAR would have been somewhere around $2500, after a 40% discount.

 

Bob

Share this post


Link to post
Share on other sites

Show me a successful compile of that code without modification and I'll eat my msp430 launchpad. :)

 

Those registers are specific to an AVR Atmega processor. There isn't any macro magic that is going to magically convert code written for an AVR Timer peripheral to an msp430 TimerA peripheral.  You often see this problem with Arduino code and libraries. They often mix the arduino API with direct register access that is specific to AVR Atmega.  That code wouldn't compile for any of the ARM Arduinos boards either.

 

Here is a link that talks about using the AVR Timer peripherals:

 

http://www.avrbeginners.net/architecture/timers/timers.html#tccrb

 

The rest of the code in that sketch is just using the Arduino API calls and those will do the right thing if you use Energia. It is just a matter of figuring out what they are doing with the AVR timer and writing msp430 specific code to do that same thing.

 

-rick

 

[Edit] I compiled on arduino for the arudino uno .. it worked fine ... I then switched over to an Arduino Zero (cortex-m0 arduino board ) and got these compiler errors:

/home/kimballr/github/Arduino/build/linux/work/arduino-builder -compile -logger=machine -hardware "/home/kimballr/github/Arduino/build/linux/work/hardware" -hardware "/home/kimballr/.arduino15/packages" -hardware "/home/kimballr/Arduino/hardware" -tools "/home/kimballr/github/Arduino/build/linux/work/tools-builder" -tools "/home/kimballr/github/Arduino/build/linux/work/hardware/tools/avr" -tools "/home/kimballr/.arduino15/packages" -built-in-libraries "/home/kimballr/github/Arduino/build/linux/work/libraries" -libraries "/home/kimballr/Arduino/libraries" -fqbn=arduino:samd:arduino_zero_edbg -ide-version=10610 -build-path "/tmp/build5ee809432791192f56b7e3894654fc94.tmp" -warnings=more -prefs=build.warn_data_percentage=75 -verbose "/home/kimballr/Arduino/sketch_jul12a/sketch_jul12a.ino"
Build options changed, rebuilding all
"/home/kimballr/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10610 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD  -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON '-DUSB_MANUFACTURER="Arduino LLC"' '-DUSB_PRODUCT="Arduino Zero"' "-I/home/kimballr/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" "-I/home/kimballr/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/cores/arduino" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/variants/arduino_zero" "/tmp/build5ee809432791192f56b7e3894654fc94.tmp/sketch/sketch_jul12a.ino.cpp" -o "/dev/null"
"/home/kimballr/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10610 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD  -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON '-DUSB_MANUFACTURER="Arduino LLC"' '-DUSB_PRODUCT="Arduino Zero"' "-I/home/kimballr/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" "-I/home/kimballr/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/cores/arduino" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/variants/arduino_zero" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/libraries/SPI" "/tmp/build5ee809432791192f56b7e3894654fc94.tmp/sketch/sketch_jul12a.ino.cpp" -o "/dev/null"
"/home/kimballr/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10610 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD  -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON '-DUSB_MANUFACTURER="Arduino LLC"' '-DUSB_PRODUCT="Arduino Zero"' "-I/home/kimballr/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" "-I/home/kimballr/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/cores/arduino" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/variants/arduino_zero" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/libraries/SPI" "/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/libraries/SPI/SPI.cpp" -o "/dev/null"
"/home/kimballr/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10610 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD  -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON '-DUSB_MANUFACTURER="Arduino LLC"' '-DUSB_PRODUCT="Arduino Zero"' "-I/home/kimballr/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" "-I/home/kimballr/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/cores/arduino" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/variants/arduino_zero" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/libraries/SPI" "/tmp/build5ee809432791192f56b7e3894654fc94.tmp/sketch/sketch_jul12a.ino.cpp" -o "/dev/null"
"/home/kimballr/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10610 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD  -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON '-DUSB_MANUFACTURER="Arduino LLC"' '-DUSB_PRODUCT="Arduino Zero"' "-I/home/kimballr/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" "-I/home/kimballr/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/cores/arduino" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/variants/arduino_zero" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/libraries/SPI" "/tmp/build5ee809432791192f56b7e3894654fc94.tmp/sketch/sketch_jul12a.ino.cpp" -o "/tmp/build5ee809432791192f56b7e3894654fc94.tmp/preproc/ctags_target_for_gcc_minus_e.cpp"
"/home/kimballr/github/Arduino/build/linux/work/tools-builder/ctags/5.8-arduino10/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/tmp/build5ee809432791192f56b7e3894654fc94.tmp/preproc/ctags_target_for_gcc_minus_e.cpp"
"/home/kimballr/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -Wall -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -DF_CPU=48000000L -DARDUINO=10610 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD  -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON '-DUSB_MANUFACTURER="Arduino LLC"' '-DUSB_PRODUCT="Arduino Zero"' "-I/home/kimballr/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" "-I/home/kimballr/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/cores/arduino" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/variants/arduino_zero" "-I/home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/libraries/SPI" "/tmp/build5ee809432791192f56b7e3894654fc94.tmp/sketch/sketch_jul12a.ino.cpp" -o "/tmp/build5ee809432791192f56b7e3894654fc94.tmp/sketch/sketch_jul12a.ino.cpp.o"
/home/kimballr/Arduino/sketch_jul12a/sketch_jul12a.ino: In function 'void setup()':
sketch_jul12a:86: error: 'TCCR1B' was not declared in this scope
   TCCR1B &= B11111000;
   ^
sketch_jul12a:88: error: 'TCCR2B' was not declared in this scope
   TCCR2B &= B11111000;
   ^
Using library SPI at version 1.0 in folder: /home/kimballr/.arduino15/packages/arduino/hardware/samd/1.6.5/libraries/SPI 
exit status 1
'TCCR1B' was not declared in this scope
And using energia .. more or less the same thing from the msp430-g++ compiler

/mnt/vbox/shared/github/Energia/build/linux/work/hardware/tools/msp430/bin/msp430-g++ -c -Os -Wall -ffunction-sections -fdata-sections -mmcu=msp430fr5969 -DF_CPU=16000000L -MMD -DARDUINO=101 -DENERGIA=17 -g -I/mnt/vbox/shared/github/Energia/build/linux/work/hardware/msp430/cores/msp430 -I/mnt/vbox/shared/github/Energia/build/linux/work/hardware/msp430/variants/launchpad_fr5969 -I/mnt/vbox/shared/github/Energia/build/linux/work/hardware/msp430/libraries/SPI /tmp/build7126674554918674956.tmp/sketch_jul12a.cpp -o /tmp/build7126674554918674956.tmp/sketch_jul12a.cpp.o 
[/mnt/vbox/shared/github/Energia/build/linux/work/hardware/tools/msp430/bin/msp430-g++, -c, -Os, -Wall, -ffunction-sections, -fdata-sections, -mmcu=msp430fr5969, -DF_CPU=16000000L, -MMD, -DARDUINO=101, -DENERGIA=17, -g, -I/mnt/vbox/shared/github/Energia/build/linux/work/hardware/msp430/cores/msp430, -I/mnt/vbox/shared/github/Energia/build/linux/work/hardware/msp430/variants/launchpad_fr5969, -I/mnt/vbox/shared/github/Energia/build/linux/work/hardware/msp430/libraries/SPI, /tmp/build7126674554918674956.tmp/sketch_jul12a.cpp, -o, /tmp/build7126674554918674956.tmp/sketch_jul12a.cpp.o]
sketch_jul12a.cpp: In function 'void setup()':
sketch_jul12a.cpp:85:3: error: 'TCCR1B' was not declared in this scope
sketch_jul12a.cpp:87:3: error: 'TCCR2B' was not declared in this scope
-rick

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×