Jump to content
43oh

Recommended Posts

@@Chuckymonkey SPI chip select pins are (usually, and certainly in this case) inactive HIGH, active LOW so you should default it to HIGH, then bring it LOW and do the SPI transfer. Bring it HIGH once you're done (doing 2 or 4 transfers to read the device). I have another theory why the Adafruit library is crashing the CC3200 but haven't sat down with my laptop to confirm my suspicions yet. (Also watching 2 toddlers all afternoon lol)

 

Sent from my Galaxy Note II with Tapatalk 4

Link to post
Share on other sites
  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

I think it's the pinMode() functions in the constructor. The GPIO peripheral modules haven't been activated by the time the C++ constructors execute so those pinMode's put the MCU into the Bus Error

@@Chuckymonkey - Try this little "patch", it's a zip file with 2 files that need to replace some files under Energia's install root (C:\energia-0101E0013 or wherever)   E13_cc3200_ctors_fix.zip  

I've also tried this code:

/*******************************************************************************
* MAX31855 Library
* Version: 1.10
* Date: 24-07-2012
* Company: Rocket Scream Electronics
* Website: www.rocketscream.com
*
* This is a MAX31855 library for Arduino. Please check our wiki 
* (www.rocketscream.com/wiki) for more information on using this piece of 
* library.
*
* This library is licensed under Creative Commons Attribution-ShareAlike 3.0 
* Unported License.
*
* Revision  Description
* ========  ===========
* 1.10			Added negative temperature support for both junction & thermocouple.
* 1.00      Initial public release.
*
*******************************************************************************/
#include	"MAX31855.h"

MAX31855::MAX31855(unsigned char SO, unsigned	char CS, unsigned char SCK)
{
	so = SO;
	cs = CS;
	sck = SCK;
	
	// MAX31855 data output pin
	pinMode(so, INPUT);
	// MAX31855 chip select input pin
	pinMode(cs, OUTPUT);
	// MAX31855 clock input pin
	pinMode(sck, OUTPUT);
	
	// Default output pins state
	digitalWrite(cs, HIGH);
	digitalWrite(sck, LOW);
}

/*******************************************************************************
* Name: readThermocouple
* Description: Read the thermocouple temperature either in Degree Celsius or
*							 Fahrenheit. Internally, the conversion takes place in the
*							 background within 100 ms. Values are updated only when the CS
*							 line is high.
*
* Argument  	Description
* =========  	===========
* 1. unit   	Unit of temperature required: CELSIUS or FAHRENHEIT
*
* Return			Description
* =========		===========
*	temperature	Temperature of the thermocouple either in Degree Celsius or 
*							Fahrenheit. If fault is detected, FAULT_OPEN, FAULT_SHORT_GND or
*							FAULT_SHORT_VCC will be returned. These fault values are outside
*							of the temperature range the MAX31855 is capable of.
*******************************************************************************/	
double	MAX31855::readThermocouple(unit_t	unit)
{
	unsigned long data;
	double temperature;
	
	// Initialize temperature
	temperature = 0;
	
	// Shift in 32-bit of data from MAX31855
	data = readData();
	
	// If fault is detected
	if (data & 0x00010000)
	{
		// Check for fault type (3 LSB)
		switch (data & 0x00000007)
		{
			// Open circuit 
			case 0x01:
				temperature = FAULT_OPEN;
				break;
			
			// Thermocouple short to GND
			case 0x02:
				temperature = FAULT_SHORT_GND;
				break;
			
			// Thermocouple short to VCC	
			case 0x04:
				temperature = FAULT_SHORT_VCC;
				break;
		}
	}
	// No fault detected
	else
	{
		// Retrieve thermocouple temperature data and strip redundant data
		data = data >> 18;
		// Bit-14 is the sign
		temperature = (data & 0x00001FFF);

		// Check for negative temperature		
		if (data & 0x00002000)
		{
			// 2's complement operation
			// Invert
			data = ~data; 
			// Ensure operation involves lower 13-bit only
			temperature = data & 0x00001FFF;
			// Add 1 to obtain the positive number
			temperature += 1;
			// Make temperature negative
			temperature *= -1; 
		}
		
		// Convert to Degree Celsius
		temperature *= 0.25;
		
		// If temperature unit in Fahrenheit is desired
		if (unit == FAHRENHEIT)
		{
			// Convert Degree Celsius to Fahrenheit
			temperature = (temperature * 9.0/5.0)+ 32; 
		}
	}
	return (temperature);
}

/*******************************************************************************
* Name: readJunction
* Description: Read the thermocouple temperature either in Degree Celsius or
*							 Fahrenheit. Internally, the conversion takes place in the
*							 background within 100 ms. Values are updated only when the CS
*							 line is high.
*
* Argument  	Description
* =========  	===========
* 1. unit   	Unit of temperature required: CELSIUS or FAHRENHEIT
*
* Return			Description
* =========		===========
*	temperature	Temperature of the cold junction either in Degree Celsius or 
*							Fahrenheit. 
*
*******************************************************************************/
double	MAX31855::readJunction(unit_t	unit)
{
	double	temperature;
	unsigned long data;
	
	// Shift in 32-bit of data from MAX31855
	data = readData();
	
	// Strip fault data bits & reserved bit
	data = data >> 4;
	// Bit-12 is the sign
	temperature = (data & 0x000007FF);
	
	// Check for negative temperature
	if (data & 0x00000800)
	{
		// 2's complement operation
		// Invert
		data = ~data; 
		// Ensure operation involves lower 11-bit only
		temperature = data & 0x000007FF;
		// Add 1 to obtain the positive number
		temperature += 1;	
		// Make temperature negative
		temperature *= -1; 
	}
	
	// Convert to Degree Celsius
	temperature *= 0.0625;
	
	// If temperature unit in Fahrenheit is desired
	if (unit == FAHRENHEIT)
	{
		// Convert Degree Celsius to Fahrenheit
		temperature = (temperature * 9.0/5.0)+ 32; 	
	}
	
	// Return the temperature
	return (temperature);
}

/*******************************************************************************
* Name: readData
* Description: Shift in 32-bit of data from MAX31855 chip. Minimum clock pulse
*							 width is 100 ns. No delay is required in this case.
*
* Argument  	Description
* =========  	===========
* 1. NIL
*
* Return			Description
* =========		===========
*	data				32-bit of data acquired from the MAX31855 chip.
*				
*******************************************************************************/
unsigned long MAX31855::readData()
{
	int bitCount;
	unsigned long data;
	
	// Clear data 
	data = 0;

	// Select the MAX31855 chip
	digitalWrite(cs, LOW);
	
	// Shift in 32-bit of data
	for (bitCount = 31; bitCount >= 0; bitCount--)
	{
		digitalWrite(sck, HIGH);
		
		// If data bit is high
		if (digitalRead(so))
		{
			// Need to type cast data type to unsigned long, else compiler will 
			// truncate to 16-bit
			data |= ((unsigned long)1 << bitCount);
		}	
		
		digitalWrite(sck, LOW);
	}
	
	// Deselect MAX31855 chip
	digitalWrite(cs, HIGH);
	
	return(data);
}

With this sketch:

/*******************************************************************************
* Thermocouple to serial for MAX31855 example 
* Version: 1.00
* Date: 26-12-2011
* Company: Rocket Scream Electronics
* Website: www.rocketscream.com
*
* This is an example of using the MAX31855 library for Arduino to read 
* temperature from a thermocouple and send the reading to serial interfacec. 
* Please check our wiki (www.rocketscream.com/wiki) for more information on 
* using this piece of library.
*
* This example code is licensed under Creative Commons Attribution-ShareAlike 
* 3.0 Unported License.
*
* Revision  Description
* ========  ===========
* 1.00      Initial public release.
*
*******************************************************************************/
// ***** INCLUDES *****
#include  <MAX31855.h>

// ***** PIN DEFINITIONS *****
const  unsigned  char thermocoupleSO = 19;
const  unsigned  char thermocoupleCS = 18;
const  unsigned  char thermocoupleCLK = 17;

MAX31855  MAX31855(thermocoupleSO, thermocoupleCS, thermocoupleCLK);

void  setup()
{
  Serial.begin(115200);
  Serial.println("Setup Complete");
  
}

void  loop()
{
  Serial.println("Starting Up");
  double  temperature;
  
  // Retrieve thermocouple temperature in Degree Celsius
  //temperature = MAX31855.readThermocouple(CELSIUS);
  Serial.print("Thermocouple temperature: ");
  Serial.print(temperature);
  Serial.println(" Degree Celsius");
  
  // Retrieve cold junction temperature in Degree Celsius
  //temperature = MAX31855.readJunction(CELSIUS);
  Serial.print("Junction temperature: ");
  Serial.print(temperature);
  Serial.println(" Degree Celsius");
  
  delay(1000);
}

and have gotten the same result.  The system just hangs, no output on the serial monitor.  I double checked the serial monitor with a simple looping text ouput and it works fine. If I take out the MAX31855  MAX31855(thermocoupleSO, thermocoupleCS, thermocoupleCLK); it works as far as printing something to the console.  I'm not really even sure why that is.

Link to post
Share on other sites

I really think it's going to be a fun project.  I'm going to mount all of this in a plastic project box with a power tail as the exposed power source.  The idea being that you take this box, plug power input to one end, output to the other, and then jack in a few sensors(thermocouple initially) to jacks I'm going to mount in the box.  You put it in learning mode so the PID algorithm can figure out how your temperatures rise and fall and then after that you use the thing.  Trying to make it so anyone can build one and attach it to pretty much any electric smoker. 

Link to post
Share on other sites

I think it's the pinMode() functions in the constructor. The GPIO peripheral modules haven't been activated by the time the C++ constructors execute so those pinMode's put the MCU into the Bus Error loop.

 

Arduino makes no bones about the fact that those type of "init" tasks shouldn't happen inside the constructor, but should be broken out to a ".begin()" method. Lots of library designers violate that rule with reckless abandon because it typically works on Arduino's original Atmel AVR platform.

 

There is a way Energia can make those things work better. We implemented it on the Tiva platform but need to see what needs changing to enable that on the CC3200.

 

Sent from my Galaxy Note II with Tapatalk 4

Link to post
Share on other sites

@@Chuckymonkey - Try this little "patch", it's a zip file with 2 files that need to replace some files under Energia's install root (C:\energia-0101E0013 or wherever)

 

E13_cc3200_ctors_fix.zip

 

In theory, this patch should fix the Energia core so the Adafruit library and the other one you posted don't crash the CPU anymore.  Again this zip file should be extracted from within the main energia-0101E0013 directory.  The files it replaces are in the "hardware\cc3200\cores\cc3200" subdirectory.

Link to post
Share on other sites
That patch cause this NPE.

 

java.lang.NullPointerException

at processing.app.debug.Compiler.execAsynchronously(Compiler.java:725)

at processing.app.debug.Compiler.compileFiles(Compiler.java:597)

at processing.app.debug.Compiler.compile(Compiler.java:240)

at processing.app.Sketch.build(Sketch.java:1594)

at processing.app.Sketch.exportApplet(Sketch.java:1617)

at processing.app.Sketch.exportApplet(Sketch.java:1603)

at processing.app.Editor$DefaultExportHandler.run(Editor.java:2520)

at java.lang.Thread.run(Thread.java:745)

 

Second try, I got this

 


core.a(startup_gcc.c.o): In function `zero_loop':

startup_gcc.c:(.text.ResetISR+0x56): undefined reference to `_init'

collect2: error: ld returned 1 exit status

Link to post
Share on other sites

Ok, got it.

 

That's a weird error you got.  Didn't see it with my Energia install.  When you have the time, can you paste the contents of "hardware\cc3200\cores\cc3200\main.cpp" ?  This should now have an "_init()" function which does all the peripheral/timer init stuff.  Something went awry there.  The replacement main.cpp is in that zip file either way.

Link to post
Share on other sites

W00t!  Doing what I said above worked!  I'm getting readings now!  They're not correct, but they're readings so I'm on the right track finally!  Thank you from the depths of my soul to Spirillis.  I may try to modify the Adafruit code and see if I get better results with that.  For now though I have beer to brew, if any of you that helped are in Colorado you are welcome to message me and drop in for a pint of homebrew.  Here's the modified code so far:

/*******************************************************************************
* MAX31855 Library
* Version: 1.10
* Date: 24-07-2012
* Company: Rocket Scream Electronics
* Website: www.rocketscream.com
*
* This is a MAX31855 library for Arduino. Please check our wiki 
* (www.rocketscream.com/wiki) for more information on using this piece of 
* library.
*
* This library is licensed under Creative Commons Attribution-ShareAlike 3.0 
* Unported License.
*
* Revision  Description
* ========  ===========
* 1.10			Added negative temperature support for both junction & thermocouple.
* 1.00      Initial public release.
*
*******************************************************************************/
#include	"MAX31855.h"

MAX31855::MAX31855(unsigned char SO, unsigned	char CS, unsigned char SCK)
{
	so = SO;
	cs = CS;
	sck = SCK;
	
	// MAX31855 data output pin
    //pinMode(so, INPUT);
	// MAX31855 chip select input pin
    //pinMode(cs, OUTPUT);
	// MAX31855 clock input pin
    //pinMode(sck, OUTPUT);

	// Default output pins state
    //digitalWrite(cs, HIGH);
    //digitalWrite(sck, LOW);
}

/*******************************************************************************
* Name: readThermocouple
* Description: Read the thermocouple temperature either in Degree Celsius or
*							 Fahrenheit. Internally, the conversion takes place in the
*							 background within 100 ms. Values are updated only when the CS
*							 line is high.
*
* Argument  	Description
* =========  	===========
* 1. unit   	Unit of temperature required: CELSIUS or FAHRENHEIT
*
* Return			Description
* =========		===========
*	temperature	Temperature of the thermocouple either in Degree Celsius or 
*							Fahrenheit. If fault is detected, FAULT_OPEN, FAULT_SHORT_GND or
*							FAULT_SHORT_VCC will be returned. These fault values are outside
*							of the temperature range the MAX31855 is capable of.
*******************************************************************************/	
double	MAX31855::readThermocouple(unit_t	unit)
{
	unsigned long data;
	double temperature;
	
	// Initialize temperature
	temperature = 0;
	
	// Shift in 32-bit of data from MAX31855
	data = readData();
	
	// If fault is detected
	if (data & 0x00010000)
	{
		// Check for fault type (3 LSB)
		switch (data & 0x00000007)
		{
			// Open circuit 
			case 0x01:
				temperature = FAULT_OPEN;
				break;
			
			// Thermocouple short to GND
			case 0x02:
				temperature = FAULT_SHORT_GND;
				break;
			
			// Thermocouple short to VCC	
			case 0x04:
				temperature = FAULT_SHORT_VCC;
				break;
		}
	}
	// No fault detected
	else
	{
		// Retrieve thermocouple temperature data and strip redundant data
		data = data >> 18;
		// Bit-14 is the sign
		temperature = (data & 0x00001FFF);

		// Check for negative temperature		
		if (data & 0x00002000)
		{
			// 2's complement operation
			// Invert
			data = ~data; 
			// Ensure operation involves lower 13-bit only
			temperature = data & 0x00001FFF;
			// Add 1 to obtain the positive number
			temperature += 1;
			// Make temperature negative
			temperature *= -1; 
		}
		
		// Convert to Degree Celsius
		temperature *= 0.25;
		
		// If temperature unit in Fahrenheit is desired
		if (unit == FAHRENHEIT)
		{
			// Convert Degree Celsius to Fahrenheit
			temperature = (temperature * 9.0/5.0)+ 32; 
		}
	}
	return (temperature);
}

/*******************************************************************************
* Name: readJunction
* Description: Read the thermocouple temperature either in Degree Celsius or
*							 Fahrenheit. Internally, the conversion takes place in the
*							 background within 100 ms. Values are updated only when the CS
*							 line is high.
*
* Argument  	Description
* =========  	===========
* 1. unit   	Unit of temperature required: CELSIUS or FAHRENHEIT
*
* Return			Description
* =========		===========
*	temperature	Temperature of the cold junction either in Degree Celsius or 
*							Fahrenheit. 
*
*******************************************************************************/
double	MAX31855::readJunction(unit_t	unit)
{
	double	temperature;
	unsigned long data;
	
	// Shift in 32-bit of data from MAX31855
	data = readData();
	
	// Strip fault data bits & reserved bit
	data = data >> 4;
	// Bit-12 is the sign
	temperature = (data & 0x000007FF);
	
	// Check for negative temperature
	if (data & 0x00000800)
	{
		// 2's complement operation
		// Invert
		data = ~data; 
		// Ensure operation involves lower 11-bit only
		temperature = data & 0x000007FF;
		// Add 1 to obtain the positive number
		temperature += 1;	
		// Make temperature negative
		temperature *= -1; 
	}
	
	// Convert to Degree Celsius
	temperature *= 0.0625;
	
	// If temperature unit in Fahrenheit is desired
	if (unit == FAHRENHEIT)
	{
		// Convert Degree Celsius to Fahrenheit
		temperature = (temperature * 9.0/5.0)+ 32; 	
	}
	
	// Return the temperature
	return (temperature);
}

/*******************************************************************************
* Name: readData
* Description: Shift in 32-bit of data from MAX31855 chip. Minimum clock pulse
*							 width is 100 ns. No delay is required in this case.
*
* Argument  	Description
* =========  	===========
* 1. NIL
*
* Return			Description
* =========		===========
*	data				32-bit of data acquired from the MAX31855 chip.
*				
*******************************************************************************/
unsigned long MAX31855::readData()
{
	int bitCount;
	unsigned long data;
	
	// Clear data 
	data = 0;

	// Select the MAX31855 chip
	digitalWrite(cs, LOW);
	
	// Shift in 32-bit of data
	for (bitCount = 31; bitCount >= 0; bitCount--)
	{
		digitalWrite(sck, HIGH);
		
		// If data bit is high
		if (digitalRead(so))
		{
			// Need to type cast data type to unsigned long, else compiler will 
			// truncate to 16-bit
			data |= ((unsigned long)1 << bitCount);
		}	
		
		digitalWrite(sck, LOW);
	}
	
	// Deselect MAX31855 chip
	digitalWrite(cs, HIGH);
	
	return(data);
}
/*******************************************************************************
* MAX31855 Library
* Version: 1.10
* Date: 24-07-2012
* Company: Rocket Scream Electronics
* Website: www.rocketscream.com
*
* This is a MAX31855 library for Arduino. Please check our wiki 
* (www.rocketscream.com/wiki) for more information on using this piece of 
* library.
*
* This library is licensed under Creative Commons Attribution-ShareAlike 3.0 
* Unported License.
*
* Revision  Description
* ========  ===========
* 1.10			Added negative temperature support for both junction & thermocouple.
* 1.00      Initial public release.
*
*******************************************************************************/
#include	"MAX31855.h"

MAX31855::MAX31855(unsigned char SO, unsigned	char CS, unsigned char SCK)
{
	so = SO;
	cs = CS;
	sck = SCK;
	
	// MAX31855 data output pin
    //pinMode(so, INPUT);
	// MAX31855 chip select input pin
    //pinMode(cs, OUTPUT);
	// MAX31855 clock input pin
    //pinMode(sck, OUTPUT);

	// Default output pins state
    //digitalWrite(cs, HIGH);
    //digitalWrite(sck, LOW);
}

/*******************************************************************************
* Name: readThermocouple
* Description: Read the thermocouple temperature either in Degree Celsius or
*							 Fahrenheit. Internally, the conversion takes place in the
*							 background within 100 ms. Values are updated only when the CS
*							 line is high.
*
* Argument  	Description
* =========  	===========
* 1. unit   	Unit of temperature required: CELSIUS or FAHRENHEIT
*
* Return			Description
* =========		===========
*	temperature	Temperature of the thermocouple either in Degree Celsius or 
*							Fahrenheit. If fault is detected, FAULT_OPEN, FAULT_SHORT_GND or
*							FAULT_SHORT_VCC will be returned. These fault values are outside
*							of the temperature range the MAX31855 is capable of.
*******************************************************************************/	
double	MAX31855::readThermocouple(unit_t	unit)
{
	unsigned long data;
	double temperature;
	
	// Initialize temperature
	temperature = 0;
	
	// Shift in 32-bit of data from MAX31855
	data = readData();
	
	// If fault is detected
	if (data & 0x00010000)
	{
		// Check for fault type (3 LSB)
		switch (data & 0x00000007)
		{
			// Open circuit 
			case 0x01:
				temperature = FAULT_OPEN;
				break;
			
			// Thermocouple short to GND
			case 0x02:
				temperature = FAULT_SHORT_GND;
				break;
			
			// Thermocouple short to VCC	
			case 0x04:
				temperature = FAULT_SHORT_VCC;
				break;
		}
	}
	// No fault detected
	else
	{
		// Retrieve thermocouple temperature data and strip redundant data
		data = data >> 18;
		// Bit-14 is the sign
		temperature = (data & 0x00001FFF);

		// Check for negative temperature		
		if (data & 0x00002000)
		{
			// 2's complement operation
			// Invert
			data = ~data; 
			// Ensure operation involves lower 13-bit only
			temperature = data & 0x00001FFF;
			// Add 1 to obtain the positive number
			temperature += 1;
			// Make temperature negative
			temperature *= -1; 
		}
		
		// Convert to Degree Celsius
		temperature *= 0.25;
		
		// If temperature unit in Fahrenheit is desired
		if (unit == FAHRENHEIT)
		{
			// Convert Degree Celsius to Fahrenheit
			temperature = (temperature * 9.0/5.0)+ 32; 
		}
	}
	return (temperature);
}

/*******************************************************************************
* Name: readJunction
* Description: Read the thermocouple temperature either in Degree Celsius or
*							 Fahrenheit. Internally, the conversion takes place in the
*							 background within 100 ms. Values are updated only when the CS
*							 line is high.
*
* Argument  	Description
* =========  	===========
* 1. unit   	Unit of temperature required: CELSIUS or FAHRENHEIT
*
* Return			Description
* =========		===========
*	temperature	Temperature of the cold junction either in Degree Celsius or 
*							Fahrenheit. 
*
*******************************************************************************/
double	MAX31855::readJunction(unit_t	unit)
{
	double	temperature;
	unsigned long data;
	
	// Shift in 32-bit of data from MAX31855
	data = readData();
	
	// Strip fault data bits & reserved bit
	data = data >> 4;
	// Bit-12 is the sign
	temperature = (data & 0x000007FF);
	
	// Check for negative temperature
	if (data & 0x00000800)
	{
		// 2's complement operation
		// Invert
		data = ~data; 
		// Ensure operation involves lower 11-bit only
		temperature = data & 0x000007FF;
		// Add 1 to obtain the positive number
		temperature += 1;	
		// Make temperature negative
		temperature *= -1; 
	}
	
	// Convert to Degree Celsius
	temperature *= 0.0625;
	
	// If temperature unit in Fahrenheit is desired
	if (unit == FAHRENHEIT)
	{
		// Convert Degree Celsius to Fahrenheit
		temperature = (temperature * 9.0/5.0)+ 32; 	
	}
	
	// Return the temperature
	return (temperature);
}

/*******************************************************************************
* Name: readData
* Description: Shift in 32-bit of data from MAX31855 chip. Minimum clock pulse
*							 width is 100 ns. No delay is required in this case.
*
* Argument  	Description
* =========  	===========
* 1. NIL
*
* Return			Description
* =========		===========
*	data				32-bit of data acquired from the MAX31855 chip.
*				
*******************************************************************************/
unsigned long MAX31855::readData()
{
	int bitCount;
	unsigned long data;
	
	// Clear data 
	data = 0;

	// Select the MAX31855 chip
	digitalWrite(cs, LOW);
	
	// Shift in 32-bit of data
	for (bitCount = 31; bitCount >= 0; bitCount--)
	{
		digitalWrite(sck, HIGH);
		
		// If data bit is high
		if (digitalRead(so))
		{
			// Need to type cast data type to unsigned long, else compiler will 
			// truncate to 16-bit
			data |= ((unsigned long)1 << bitCount);
		}	
		
		digitalWrite(sck, LOW);
	}
	
	// Deselect MAX31855 chip
	digitalWrite(cs, HIGH);
	
	return(data);
}
Link to post
Share on other sites

As requested here's the original Main.cpp file:

#include <Energia.h>
#include "inc/hw_gpio.h"
#include "driverlib/rom_map.h"
#include "driverlib/prcm.h"
#include "driverlib/interrupt.h"
#include "driverlib/systick.h"
#include <driverlib/utils.h>
#include "inc/hw_hib1p2.h"
#include "inc/hw_hib3p3.h"

extern void (* const g_pfnVectors[])(void);

int main(void)
{
	IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);

	MAP_PRCMPeripheralClkEnable(PRCM_GPIOA0, PRCM_RUN_MODE_CLK);
	MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);
	MAP_PRCMPeripheralClkEnable(PRCM_GPIOA2, PRCM_RUN_MODE_CLK);
	MAP_PRCMPeripheralClkEnable(PRCM_GPIOA3, PRCM_RUN_MODE_CLK);

	MAP_IntMasterEnable();
	PRCMCC3200MCUInit();
	MAP_SysTickIntEnable();
	MAP_SysTickPeriodSet(F_CPU / 1000);
	MAP_SysTickEnable();

	setup();

	for (; {
		loop();
		if (serialEventRun) serialEventRun();
	}
}

Here's the one that was sent to me and throws the error:

#include <Energia.h>
#include "inc/hw_gpio.h"
#include "driverlib/rom_map.h"
#include "driverlib/prcm.h"
#include "driverlib/interrupt.h"
#include "driverlib/systick.h"
#include <driverlib/utils.h>
#include "inc/hw_hib1p2.h"
#include "inc/hw_hib3p3.h"

extern void (* const g_pfnVectors[])(void);

#ifdef __cplusplus
extern "C" {
#endif

void _init(void)
{
	IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);

	MAP_PRCMPeripheralClkEnable(PRCM_GPIOA0, PRCM_RUN_MODE_CLK);
	MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);
	MAP_PRCMPeripheralClkEnable(PRCM_GPIOA2, PRCM_RUN_MODE_CLK);
	MAP_PRCMPeripheralClkEnable(PRCM_GPIOA3, PRCM_RUN_MODE_CLK);

	MAP_IntMasterEnable();
	PRCMCC3200MCUInit();
	MAP_SysTickIntEnable();
	MAP_SysTickPeriodSet(F_CPU / 1000);
	MAP_SysTickEnable();
} /* void _init(void) */

#ifdef __cplusplus
} /* extern "C" */
#endif

int main(void)
{
	setup();

	for (; {
		loop();
		if (serialEventRun) serialEventRun();
	}
}

Link to post
Share on other sites

I did as you suggested and copied the text in.  It's working now with the pinMode being set in the constructor of the library.  I didn't know about that problem with it, so excellent call on that.  The readings are still way off from what I get out of the Arduino, but I'm going to play with that for a little bit and see if I can fix it.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...