Part Number: MSP432P401R
Tool/software: Code Composer Studio
I have a number of the older msp432p401r (Black boards)
currently using CCS Version: 6.1.1.00022
MSP432 Device Support Files 6.1.0.6 com.ti.ccstudio.msp432.emu.win32.feature.group Texas Instruments
the issue is I love writing code directly, the problem is the syntax in the examples use this format
EUSCI_B0->CTLW0 |= EUSCI_B_CTLW0_SWRST; // Remain eUSCI_B in reset state
while I'm used to code in this format
UCB0CTLW0 |= UCSWRST; /* Software reset enable */
I also have a problem with interrupts
in msp432_startup.ccs.c line 103
" defaultISR, /* EUSCIB0 ISR */
I change this to
EUSCIB0_IRQHandler
but also msp432p401r.h has an interrupt vector
EUSCIB0_IRQn = 20, /* 36 EUSCIB0 Interrupt */
Why are there 2 different IRQ handlers msp432_startup.ccs.c and msp432p401r.h
now on to NVIC
the new method uses
// Enable eUSCIB0 interrupt in NVIC module
NVIC->ISER[0] = 1 << ((EUSCIB0_IRQn) & 31);
old preferred
NVIC_ISER0 |= INTISR20; // eUSCI_B0
taken from msp432p401r_classic.h
#define INTISR20 0x00100000 // eUSCI_B0
the real problem is when I do run the code, it never gets to the interrupt routine my code is below
been working on a routine just to initialize the slave device, but no luck, I also have a logic analyzer, I can see the start bit along with the slave address, then the clock goes low and hangs with TXing any data as if the Interrupt is never executed and the TXBUFFER is never loaded, due to the Interrupt not being handled.
in-addition Lastly I get a ton of these warnings
Description Resource Path Location Type
#2120-D static function "EUSCIB0_IRQHandler" treated as extern because it was referenced but not defined msp432_startup_ccs.c /blk_sensor_version2 line 45 C/C++ Problem
#48-D incompatible redefinition of macro "ADDMASK_M" (declared at line 3160 of "C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r_classic.h") .ccsproject /blk_sensor_version2 line 13192, external location: C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r.h C/C++ Problem
#48-D incompatible redefinition of macro "ADDMASK_OFS" (declared at line 3159 of "C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r_classic.h") .ccsproject /blk_sensor_version2 line 13191, external location: C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r.h C/C++ Problem
#48-D incompatible redefinition of macro "ADDRX_M" (declared at line 3157 of "C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r_classic.h") .ccsproject /blk_sensor_version2 line 13189, external location: C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r.h C/C++ Problem
#48-D incompatible redefinition of macro "ADDRX_OFS" (declared at line 3156 of "C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r_classic.h") .ccsproject /blk_sensor_version2 line 13188, external location: C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r.h C/C++ Problem
#48-D incompatible redefinition of macro "AESBLKCNT_M" (declared at line 1619 of "C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r_classic.h") .ccsproject /blk_sensor_version2 line 9229, external location: C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r.h C/C++ Problem
#48-D incompatible redefinition of macro "AESBLKCNT_OFS" (declared at line 1618 of "C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r_classic.h") .ccsproject /blk_sensor_version2 line 9228, external location: C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r.h C/C++ Problem
#48-D incompatible redefinition of macro "AESBLKCNT0" (declared at line 1620 of "C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r_classic.h") .ccsproject /blk_sensor_version2 line 9219, external location: C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r.h C/C++ Problem
#48-D incompatible redefinition of macro "AESBLKCNT1" (declared at line 1621 of "C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r_classic.h") .ccsproject /blk_sensor_version2 line 9220, external location: C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r.h C/C++ Problem
#48-D incompatible redefinition of macro "AESBLKCNT2" (declared at line 1622 of "C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r_classic.h") .ccsproject /blk_sensor_version2 line 9221, external location: C:\ti_blk_ccs6\ccsv6\ccs_base\arm\include\msp432p401r.h C/C++ Problem
//***************************************************************************** // // A0 P5.5* // A1 P5.4* // A2 P5.3 // A3 P5.2* // A4 P5.1* // A5 P5.0* // A6 P4.7* // A7 P4.6* // A8 P4.5* // A9 P4.4* // A10 P4.3* // A11 P4.2* // A12 P4.1* // A13 P4.0* // A14 P6.1* // A15 P6.0* // A16 P9.1# // A17 P9.0# // A18 P8.7# // A19 P8.6# // A20 P8.5# // A21 P8.4# // A22 P8.3# // A23 P8.2# // // // I2C P1.6* // I2C P1.7* // // I2C to LCD // P0 P1 P2 P3 P4 P5 P6 P7 // RS R/W E X D0 D1 D2 D3 D4 D5 D6 D7 // //**************************************************************************** //**************************************************************************** #include "msp.h" void LCD_init(void); volatile uint32_t TXData_x = 0x00; volatile uint32_t TXData_y = 0x00; uint32_t TXData[64];// uint32_t TXData_value;// uint32_t i = 0x0000;;// void main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer P1SEL0 |= BIT6 | BIT7; // I2C pins P1.6=SDA P1.7=SCL NVIC_ICPR0 = 0xFFFFFFFF; // clr INT NVIC_ICPR1 = 0xFFFFFFFF; // clr INT NVIC_ISER0 |= INTISR20; // 1 << ((EUSCIB0_IRQn) & 31); // Enable eUSCIB0 interrupt in NVIC module // Configure USCI_B0 for I2C mode LCD_init(); UCB0CTLW0 |= UCSWRST; // hold in RST UCB0CTLW0 = UCSWRST | UCTR |UCMODE_3 | UCMST | UCSYNC | UCSSEL__SMCLK; // I2C, TX, Mstr UCB0CTLW1 |= UCASTP_1; // stop sent after byte ctr value UCB0BRW = 0x001E; // baudrate = SMCLK /30 UCB0CTLW0 &= ~UCSWRST; // clr RST hold UCB0IE |= UCTXIE0 | UCNACKIE; // Enable interrupt __enable_interrupt(); UCB0CTLW0 |= UCTXSTP; // tx a STOP and try to restart for (i = 300; i > 0; i--); // kill some time UCB0I2CSA = 0x27; // slave address UCB0CTLW0 |= UCTXSTT; // send a start while(UCB0STATW & 0x0010) // check if bus is busy { __no_operation(); // for debug } } void LCD_init(void) // using a A2004 LCD along with PCF8574 I2C to 8bit out { TXData[0x00] = 0x22; // set to 4 bit TXData[0x01] = 0x02; // drop "E" to accept data // now 4 bit High then Low TXData[0x02] = 0x22; TXData[0x03] = 0x02; TXData[0x04] = 0x20; TXData[0x05] = 0x00; TXData[0x06] = 0x20; // reset display TXData[0x07] = 0x00; TXData[0x08] = 0x21; TXData[0x09] = 0x01; TXData[0x0A] = 0xA4; // A TXData[0x0B] = 0x84; TXData[0x0C] = 0xA1; TXData[0x0D] = 0x81; TXData[0x0E] = 0xA4; // B TXData[0x0F] = 0x84; TXData[0x10] = 0xA2; TXData[0x11] = 0x82; TXData[0x12] = 0xA4; // C TXData[0x13] = 0x84; TXData[0x14] = 0xA3; TXData[0x15] = 0x83; TXData[0x16] = 0xA4; // D TXData[0x17] = 0x84; TXData[0x18] = 0xA4; TXData[0x19] = 0x84; TXData[0x1A] = 0xFFFF; // EOF TXData[0x1B] = 0xFFFF; TXData[0x1C] = 0xFFFF; TXData[0x1D] = 0xFFFF; } void EUSCIB0_IRQHandler(void) // never get executed { if(UCB0IFG & UCTXIFG0) // TX buffer is empty { if (TXData[TXData_x] == 0xFFFF) { UCB0CTLW0 |= UCTXSTP; // tx a stop condition __no_operation(); } else { UCB0TXBUF = TXData[TXData_x]; // load TX buffer with new value TXData_x++; } } if(UCB0IFG & UCNACKIFG) // received a NACK { UCB0CTLW0 |= UCTXSTP; // tx a STOP and try to restart for (i = 300; i > 0; i--); // kill some time } }
any help is appreciated
Regards
Roman
msp432_startup.ccs.c