Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

MSP-EXP430FR2433: MSP430WARE code port for 430BOOST-SHARP96

$
0
0

Part Number:MSP-EXP430FR2433

Hi,

The Energia LCD_SharpBoosterPack_SPI works fine with the MSP430FR2433, however I did not see an example or code for the 430BOOST-SHARP96 in MSP340WARE, or anywhere else for that matter, so I took the MSP-EXP430FR4133_Grlib_Example from msp430ware_3_80_02_10 and made the appropriate changes to the code to support the MSP430FR2433.  

1. Import BlinkLED_MSP430FR2433 project from MSP430WARE to CCS (CCS Version: 7.3.0.00019 in this case)

2. Import  MSP-EXP430FR4133_Grlib_Example from MSP430WARE to CCS 

3. Copy the GrLib and LcdDriver folders and file 'system_pre_init.c' to the MSP430FR2433 project

    NOTE: References to LcdDriver, GrLib, GrLib/grlib, and GrLib/fonts must be added to the Project Include Options.  

4. Modify the HAL_MSP files for the FR2433 Launchpad

    Rename: HAL_MSP_EXP430FR4133_Sharp96x96.c and HAL_MSP_EXP430FR4133_Sharp96x96.h

                   to

                    HAL_MSP_EXP430FR2433_Sharp96x96.c and HAL_MSP_EXP430FR2433_Sharp96x96.h 

5. In HAL_MSP_EXP430FR2433_Sharp96x96.h change the PIN references to:

#ifndef LCDDRIVER_HAL_MSP_EXP430FR2433_SHARP96X96_H_
#define LCDDRIVER_HAL_MSP_EXP430FR2433_SHARP96X96_H_

//*****************************************************************************
//
// User Configuration for the LCD Driver
//
//*****************************************************************************

// Ports from MSP430 connected to LCD
#define LCD_SPI_SI_PORT                     GPIO_PORT_P2
#define LCD_SPI_CLK_PORT                    GPIO_PORT_P2
#define LCD_DISP_PORT                       GPIO_PORT_P1
#define LCD_POWER_PORT                      GPIO_PORT_P1
#define LCD_SPI_CS_PORT                     GPIO_PORT_P1

// Pins from MSP430 connected to LCD
#define LCD_SPI_SI_PIN                      GPIO_PIN6
#define LCD_SPI_SI_PIN_FUNCTION             GPIO_PRIMARY_MODULE_FUNCTION
#define LCD_SPI_CLK_PIN                     GPIO_PIN4
#define LCD_SPI_CLK_PIN_FUNCTION            GPIO_PRIMARY_MODULE_FUNCTION
#define LCD_DISP_PIN                        GPIO_PIN6
#define LCD_POWER_PIN                       GPIO_PIN0
#define LCD_SPI_CS_PIN                      GPIO_PIN7

// Definition of USCI base address to be used for SPI communication
//#define LCD_EUSCI_BASE                EUSCI_B0_BASE
#define LCD_EUSCI_BASE                EUSCI_A1_BASE

.
.
.
#endif /* LCDDRIVER_HAL_MSP_EXP430FR2433_SHARP96X96_H_ */

6. Edit HAL_MSP_EXP430FR4133_Sharp96x96.c to match the FR2433 EUSCI mappings

#include "grlib.h"
#include "HAL_MSP_EXP430FR2433_Sharp96x96.h"
#include "driverlib.h"
.
.
.
    HAL_LCD_clearCS();

    EUSCI_A_SPI_initMasterParam param = {0};
    param.selectClockSource = EUSCI_A_SPI_CLOCKSOURCE_SMCLK;
    param.clockSourceFrequency = CS_getSMCLK();
    param.desiredSpiClock = 1000000;
    param.msbFirst = EUSCI_A_SPI_MSB_FIRST;
    param.clockPhase = EUSCI_A_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT;
    param.clockPolarity = EUSCI_A_SPI_CLOCKPOLARITY_INACTIVITY_LOW;
    param.spiMode = EUSCI_A_SPI_3PIN;

    EUSCI_A_SPI_initMaster(LCD_EUSCI_BASE,&param);

    EUSCI_A_SPI_enable(LCD_EUSCI_BASE);
.
.
.
void HAL_LCD_writeCommandOrData(uint16_t command)
{
    while(!EUSCI_A_SPI_getInterruptStatus(LCD_EUSCI_BASE,
                                          EUSCI_A_SPI_TRANSMIT_INTERRUPT))
    {
        ;
    }
    EUSCI_A_SPI_transmitData(LCD_EUSCI_BASE,command);
}

void HAL_LCD_waitUntilLcdWriteFinish(void)
{
    while(EUSCI_A_SPI_isBusy(LCD_EUSCI_BASE))
    {
        ;
    }
}

7. Either copy the contents of main.c or just copy the file to the FR2433 project

After this, the LCD Demo should work as expected. 

 

I hope this helps someone else.  


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>