Hi!
I'm using MSP430FE4252 in my project. And I need to connect it to the display via SPI.
At first I configure USART module:
//setup USART0 in SPI mode LCD_MOSI_SEL |= LCD_MOSI_PIN; LCD_CLK_SEL |= LCD_CLK_PIN; UBR00 = 0x02;// set baud divide by two UBR10 = 0x00; U0CTL |= SWRST;//Reset U0ME |= USPIE0;//switch On SPI module U0CTL |= SYNC + CHAR + MM;//SPI 8 bit Master Mode U0TCTL |= STC;//3-pin SPI mode U0TCTL |= SSEL1;//use MCLK U0CTL &= ~(SWRST);//Rest Done
And send to display comand and data without interrupts:
void WriteCommand(uint8_t ucData) { // Store current GIE state uint16_t gie = __get_SR_register() & GIE; // Make this operation atomic __disable_interrupt(); ClearCS(); LCD_CD_PORT &= ~LCD_CD_PIN; while(! (U0TCTL & TXEPT)); U0TXBUF = ucData; while(! (U0TCTL & TXEPT) ); // CS High SetCS(); // Restore original GIE state __bis_SR_register(gie); __enable_interrupt(); }
Start Debug (CCS V5.5) via MSP30FET and via Logic Analyzer watch next picture
WAT? Inverse Logic in MOSI signal and additional bits in It (there are 12 bits in CLK signal)..
Pause Debug and looking through registers:
All is good (as I think). SPI mode, in U0TCTL CKPH and CKPL are equals zero..
On some other MCU-s USCI module with ~same config works well..
What I need to do to have normal MOSI signal?
PS: I tried to reset U0MCTL with the same result