Jump to content
43oh

CapSense-Launchpad with the Evalbot


Recommended Posts

Hey guys, I just had to share the status of this project. So far it's working. :D This attempt doesn't use SimpliciTI on the evalbot, just using the UART to get started. The ez430-rf2500t devices are configured as wireless UARTs with code from the EKG booster.

Currently, the bot receives code but does nothing with it. I'm going to implement a very simple controller with no sensors involved and build from there. After I clean up and better comment the code, I will get it posted.

 

The next step will be to use SimpliciTI on the Evalbot and directly control the CC2500. I already have the SPI lines broken out and ready to go. Also, the controller will be the MSP-EXP430F5529 which will also run SimpliciTI and have the rf2500t plugged directly onto the board. I have SimpliciTi running on that along side the HAL drivers. Struggled for a bit but the only reason I was hanging up the SPI bus is because the F2274 was still running a program connecting to the radio.

 

I work on too many projects simultaneously. Pretty sure I'm not the only one.

Link to post
Share on other sites

Nice to see your progress with the evalbot. Mine is just sitting on my desk like a paperweight. So you have the captouch booster and the RF2500 connected to the launchpad at the same time, and the RF2500 board retransmits the UART wirelessly? If I understand that correctly, that's so cool!!!

Link to post
Share on other sites
  • 7 months later...

Hello guille36, there's not much code to share.

 

TI's unreleased EKG Booster Pack contains the wireless UART software for the RF2500t. http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/EKG-Based-Heart-Rate-Monitor/1_00_00_00/index_FDS.html

 

The default CapSense Booster pack software is installed on the Launchpad.

 

On the Evalbot, it's collecting the data via the UART and simply toggling the LED via the UART ISR. The code I'm running on the bot is below. As of now, the bot displays a simple logo and the temperature. LED is toggling on data receive. No drive functions have been enabled as of yet.

 

main_app.c

#include 
#include "utils/ustdlib.h"

#include "lm3s9b92.h"

#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "inc/hw_ethernet.h"
#include "inc/hw_timer.h"
#include "inc/hw_ints.h"

#include "driverlib/ethernet.h"
#include "driverlib/gpio.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "driverlib/interrupt.h"
#include "driverlib/adc.h"
#include "driverlib/timer.h"
#include "driverlib/uart.h"

#include "display96x16x1.h"
#include "io.h"

void set_PLL(void);
void ethernet_OFF(void);
void init_ADC(void);
void init_RTC(void);
void sample_Temperature(void);

static volatile unsigned long g_ulTickCount;

unsigned long ulADC0_Value[1];
unsigned int ulTemp_ValueC;
unsigned int ulTemp_ValueF;

char buffer[8] = "00000000";

static const unsigned char gwdev[96*2] = {
//top 8 rows, 96 columns
0,0,0,0, 0x3E, 0x22, 0x2A, 0x3A, 0, 0x0C, 0x10, 0x20, 0x10, 0x18, 0x20, 0x10, 0x0c, 0, 0x3E, 0x22, 0x22, 0x1C, 0,
0x3C, 0x2C, 0x24, 0x2C, 0, 0x0C, 0x10, 0x20, 0x10, 0x0C, 0, 0x3C, 0x2C, 0x24, 0x2C, 0, 0x3E, 0,
0x3C, 0x24, 0x24, 0x3C, 0, 0x7E, 0x12, 0x12, 0x0C, 0, 0x3C, 0x2C, 0x24, 0x2C, 0, 0x3C, 0x08, 0x04, 0x04,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

//bottom 8 rows, 96 columns
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

};

void main(void) {

set_PLL(); 													// set clock to run from PLL at 20Mhz
ethernet_OFF();		//conflict with bsp!					// turn off to save batteries
init_ADC();
init_RTC();
LEDsInit();

SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
   SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

GPIOPinConfigure(GPIO_PB4_U1RX);
   GPIOPinConfigure(GPIO_PB5_U1TX);

GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_4 | GPIO_PIN_5);

UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), 9600,
                           UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                           UART_CONFIG_PAR_NONE);

IntEnable(INT_UART1);
   UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT);


/* set systick and enable interrupts */

SysTickPeriodSet(SysCtlClockGet() / 1 );
IntMasterEnable();
   SysTickIntEnable();
   SysTickEnable();

   /**/

Display96x16x1Init(true);									// init OLED
Display96x16x1ImageDraw(gwdev, 0, 0, 96, 2);				// display logo


   while (1) {

   sample_Temperature();

   Display96x16x1StringDraw(buffer, 79, 0);

   };

}

void set_PLL(void) {

// use PLL, main OSC and 16MHZ xtal

SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                  SYSCTL_XTAL_16MHZ);

}

void init_ADC(void) {

SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); //enable adc0
ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0); // sequence 3 is single sample, processor trigger
ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_TS | ADC_CTL_IE | ADC_CTL_END); // sample and set int when done
ADCSequenceEnable(ADC0_BASE, 3); // enable sequence
ADCIntClear(ADC0_BASE, 3); // clear interrupt

}


void init_RTC(void) {

SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
TimerConfigure(TIMER0_BASE, TIMER_CFG_32_BIT_PER );
TimerLoadSet(TIMER0_BASE, TIMER_A, SysCtlClockGet());
TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
IntEnable(INT_TIMER0A);
TimerEnable(TIMER0_BASE, TIMER_A);

}

void sample_Temperature(void) {

ADCProcessorTrigger(ADC0_BASE, 3);

while(!ADCIntStatus(ADC0_BASE, 3, false))
       {
       }

   ADCSequenceDataGet(ADC0_BASE, 3, ulADC0_Value);
   ulTemp_ValueC = ((1475 * 1023) - (2250 * ulADC0_Value[0])) / 10230;
   ulTemp_ValueF = ((ulTemp_ValueC * 9) + 160) / 5;

   SysCtlDelay(SysCtlClockGet() / 12);

   usprintf(buffer, "%dF", ulTemp_ValueF);

}

void ethernet_OFF(void) {

unsigned long ulPHYMR0;

SysCtlPeripheralEnable(SYSCTL_PERIPH_ETH);
   ulPHYMR0 = EthernetPHYRead(ETH_BASE, PHY_MR0);
   EthernetPHYWrite(ETH_BASE, PHY_MR0, ulPHYMR0 | PHY_MR0_PWRDN);

}

// SysTick ISR
void SysTickHandler(void) {

   // Increment the tick counter, should be 1 second
   g_ulTickCount++;

   //LED_Toggle(LED_2);

}

// RTC ISR
void RTC_IntHandler(void) {

TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);

//TimerGetValue

// insert ulocaltime conversion here

LED_Toggle(LED_1);

}

// UART1 ISR
void
UART1_IntHandler(void)
{
   unsigned long ulStatus;

LED_Toggle(LED_2);

   //
   // Get the interrrupt status.
   //
   ulStatus = UARTIntStatus(UART1_BASE, true);

   //
   // Clear the asserted interrupts.
   //
   UARTIntClear(UART1_BASE, ulStatus);

   //
   // Loop while there are characters in the receive FIFO.
   //
   while(UARTCharsAvail(UART1_BASE))
   {

       //
       // Read the next character from the UART and write it back to the UART.
       //
       UARTCharPutNonBlocking(UART1_BASE,
                                  UARTCharGetNonBlocking(UART1_BASE));
   }
}

And.

startup.c

//*****************************************************************************
//
// startup_ccs.c - Startup code for use with TI's Code Composer Studio.
//
// Copyright (c) 2011 Texas Instruments Incorporated.  All rights reserved.
// Software License Agreement
// 
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
// 
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 7243 of the Stellaris Firmware Development Package.
//
//*****************************************************************************

//*****************************************************************************
//
// Forward declaration of the default fault handlers.
//
//*****************************************************************************
void ResetISR(void);
static void NmiSR(void);
static void FaultISR(void);
static void IntDefaultHandler(void);

//*****************************************************************************
//
// External declaration for the reset handler that is to be called when the
// processor is started
//
//*****************************************************************************
extern void _c_int00(void);

//*****************************************************************************
//
// Linker variable that marks the top of the stack.
//
//*****************************************************************************
extern unsigned long __STACK_TOP;

//*****************************************************************************
//
// External declarations for the interrupt handlers used by the application.
//
//*****************************************************************************
extern void SoundIntHandler(void);
extern void SysTickHandler(void);
extern void RTC_IntHandler(void);
extern void UART1_IntHandler(void);

//*****************************************************************************
//
// The vector table.  Note that the proper constructs must be placed on this to
// ensure that it ends up at physical address 0x0000.0000 or at the start of
// the program if located at a start address other than 0.
//
//*****************************************************************************
#pragma DATA_SECTION(g_pfnVectors, ".intvecs")
void (* const g_pfnVectors[])(void) =
{
   (void (*)(void))((unsigned long)&__STACK_TOP),
                                           // The initial stack pointer
   ResetISR,                               // The reset handler
   NmiSR,                                  // The NMI handler
   FaultISR,                               // The hard fault handler
   IntDefaultHandler,                      // The MPU fault handler
   IntDefaultHandler,                      // The bus fault handler
   IntDefaultHandler,                      // The usage fault handler
   0,                                      // Reserved
   0,                                      // Reserved
   0,                                      // Reserved
   0,                                      // Reserved
   IntDefaultHandler,                      // SVCall handler
   IntDefaultHandler,                      // Debug monitor handler
   0,                                      // Reserved
   IntDefaultHandler,                      // The PendSV handler
   SysTickHandler,                         // The SysTick handler
   IntDefaultHandler,                      // GPIO Port A
   IntDefaultHandler,                      // GPIO Port B
   IntDefaultHandler,                      // GPIO Port C
   IntDefaultHandler,                      // GPIO Port D
   IntDefaultHandler,                      // GPIO Port E
   IntDefaultHandler,                      // UART0 Rx and Tx
   UART1_IntHandler,                      // UART1 Rx and Tx
   IntDefaultHandler,                      // SSI0 Rx and Tx
   IntDefaultHandler,                      // I2C0 Master and Slave
   IntDefaultHandler,                      // PWM Fault
   IntDefaultHandler,                      // PWM Generator 0
   IntDefaultHandler,                      // PWM Generator 1
   IntDefaultHandler,                      // PWM Generator 2
   IntDefaultHandler,                      // Quadrature Encoder 0
   IntDefaultHandler,                      // ADC Sequence 0
   IntDefaultHandler,                      // ADC Sequence 1
   IntDefaultHandler,                      // ADC Sequence 2
   IntDefaultHandler,                      // ADC Sequence 3
   IntDefaultHandler,                      // Watchdog timer
   RTC_IntHandler,                      // Timer 0 subtimer A
   IntDefaultHandler,                      // Timer 0 subtimer B
   IntDefaultHandler,                      // Timer 1 subtimer A
   IntDefaultHandler,                      // Timer 1 subtimer B
   IntDefaultHandler,                      // Timer 2 subtimer A
   IntDefaultHandler,                      // Timer 2 subtimer B
   IntDefaultHandler,                      // Analog Comparator 0
   IntDefaultHandler,                      // Analog Comparator 1
   IntDefaultHandler,                      // Analog Comparator 2
   IntDefaultHandler,                      // System Control (PLL, OSC, BO)
   IntDefaultHandler,                      // FLASH Control
   IntDefaultHandler,                      // GPIO Port F
   IntDefaultHandler,                      // GPIO Port G
   IntDefaultHandler,                      // GPIO Port H
   IntDefaultHandler,                      // UART2 Rx and Tx
   IntDefaultHandler,                      // SSI1 Rx and Tx
   IntDefaultHandler,                      // Timer 3 subtimer A
   IntDefaultHandler,                      // Timer 3 subtimer B
   IntDefaultHandler,                      // I2C1 Master and Slave
   IntDefaultHandler,                      // Quadrature Encoder 1
   IntDefaultHandler,                      // CAN0
   IntDefaultHandler,                      // CAN1
   IntDefaultHandler,                      // CAN2
   IntDefaultHandler,                      // Ethernet
   IntDefaultHandler,                      // Hibernate
   IntDefaultHandler,                      // USB0
   IntDefaultHandler,                      // PWM Generator 3
   IntDefaultHandler,                      // uDMA Software Transfer
   IntDefaultHandler,                      // uDMA Error
   IntDefaultHandler,                      // ADC1 Sequence 0
   IntDefaultHandler,                      // ADC1 Sequence 1
   IntDefaultHandler,                      // ADC1 Sequence 2
   IntDefaultHandler,                      // ADC1 Sequence 3
   SoundIntHandler,                        // I2S0
   IntDefaultHandler,                      // External Bus Interface 0
   IntDefaultHandler                       // GPIO Port J
};

//*****************************************************************************
//
// This is the code that gets called when the processor first starts execution
// following a reset event.  Only the absolutely necessary set is performed,
// after which the application supplied entry() routine is called.  Any fancy
// actions (such as making decisions based on the reset cause register, and
// resetting the bits in that register) are left solely in the hands of the
// application.
//
//*****************************************************************************
void
ResetISR(void)
{
   //
   // Jump to the CCS C Initialization Routine.
   //
   __asm("    .global _c_int00\n"
         "    b.w     _c_int00");
}

//*****************************************************************************
//
// This is the code that gets called when the processor receives a NMI.  This
// simply enters an infinite loop, preserving the system state for examination
// by a debugger.
//
//*****************************************************************************
static void
NmiSR(void)
{
   //
   // Enter an infinite loop.
   //
   while(1)
   {
   }
}

//*****************************************************************************
//
// This is the code that gets called when the processor receives a fault
// interrupt.  This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void
FaultISR(void)
{
   //
   // Enter an infinite loop.
   //
   while(1)
   {
   }
}

//*****************************************************************************
//
// This is the code that gets called when the processor receives an unexpected
// interrupt.  This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void
IntDefaultHandler(void)
{
   //
   // Go into an infinite loop.
   //
   while(1)
   {
   }
}

 

That's pretty much where I paused the project. The bot is a really nice learning toy but I've got other projects that are taking priority.

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...