Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: MSP430F5529, C2000WARE, CONTROLSUITE,
Hello! I'm trying to receive a string from an HC06 running at 9600BAUD. I have the same system working on the MSP430F5529.
This is the code that I imagine should be working. My problem is not actually receiving anything in RXBUF. I am getting interrupted which means I am receiving a byte, but nothing is being transferred to my array.
I've tried assuming LSPCLK is at 90MHz, and the default SYSCLK/4, which equates to 22.5MHz. Using the formula:
LSPCLK/(9600*8) - 1, I've found a value of 0x123 FOR 22.5MHz and a value of 0x492 for 90MHz to be stored in:
SciaRegs.SCIHBAUD = 0x0000;
SciaRegs.SCILBAUD = 0x0492; // 9600 BAUD, ive also tried 0x0123.
I must be doing something wrong! If someone could help me, that'd be greatly appreciated as this a small part for a school project!
Thanks!
Heres the code i'm running (the relevant stuff):
__interrupt void sciaRxFifoIsr(void);
char RXParseData[256] = {}; // Array which stores the data received in RXBUF
void main(void)
{
//--- CPU Initialization
InitSysCtrl(); // Initialize the CPU (FILE: SysCtrl.c)
InitPieCtrl(); // Initialize and enable the PIE (FILE: PieCtrl.c)
InitWatchdog(); // Initialize the Watchdog Timer (FILE: WatchDog.c)
//---- SCI -- SETUP
EALLOW;
/* Enable internal pull-up for the selected pins */
// Pull-ups can be enabled or disabled disabled by the user.
// This will enable the pullups for the specified pins.
GpioCtrlRegs.GPAPUD.bit.GPIO28 = 0; // Enable pull-up for GPIO28 (SCIRXDA)
/* Set qualification for selected pins to asynch only */
// Inputs are synchronized to SYSCLKOUT by default.
// This will select asynch (no qualification) for the selected pins.
GpioCtrlRegs.GPAQSEL2.bit.GPIO28 = 3; // Asynch input GPIO28 (SCIRXDA)
/* Configure SCI-A pins using GPIO regs*/
// This specifies which of the possible GPIO pins will be SCI functional pins.
GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 1; // Configure GPIO28 for SCIRXDA operation
EDIS;
// END SCI SETUP
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the F2806x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in F2806x_DefaultIsr.c.
// This function is found in F2806x_PieVect.c.
InitPieVectTable();
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.SCIRXINTA = &sciaRxFifoIsr;
EDIS; // This is needed to disable write to EALLOW protected registers
//FIFO SETUP
SciaRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
SciaRegs.SCICTL1.all =0x0001; // enable RX, internal SCICLK,
// Disable TX, RX ERR, SLEEP, TXWAKE
SciaRegs.SCICTL2.bit.RXBKINTENA =1;
SciaRegs.SCIHBAUD = 0x0000;
SciaRegs.SCILBAUD = 0x0492; // 9600 BAUD, ive also tried 0x0123.
SciaRegs.SCIFFRX.all=0x0022;
SciaRegs.SCIFFCT.all=0x00;
SciaRegs.SCICTL1.all =0x0021; // Relinquish SCI from Reset
SciaRegs.SCIFFRX.bit.RXFIFORESET=1;
// Enable interrupts required for this example
PieCtrlRegs.PIECTRL.bit.ENPIE = 1; // Enable the PIE block
PieCtrlRegs.PIEIER9.bit.INTx1=1; // PIE Group 9, INT1
PieCtrlRegs.PIEIER9.bit.INTx2=1; // PIE Group 9, INT2
IER = 0x100; // Enable CPU INT
EINT;
//--- Enable global interrupts
asm(" CLRC INTM, DBGM"); // Enable global interrupts and realtime debug
}
__interrupt void sciaRxFifoIsr(void)
{
Uint16 i = 0;
while(1)
{
RXParseData[i]=SciaRegs.SCIRXBUF.all;
i++;
}
SciaRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
SciaRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ack
}

