Hi to all!
MC is MSP430FR5726 (FR57xx family)
It has eUSCI_A0 and eUSCI_B0. I use the 1-st of them in UART mode and I want to use the 2-nd in SPI mode.
Problem: there is no clocks at the UCB0CLK pin.
The relevant info may be summed up so:
1) The USC0CLK pin is checked electrically: being configured as OUTPUT port it may be set to "0" or "1"
2) The eUSCI is configured: when I put a byte in the UCB0TXBUF it is transmitted correctly - but without the clock pulses at the USC0CLK pin (as if it is a UART mode!)
I double checked UCSYNC bit and UCMODE0...1 bits in UCB0CTLW0 register - it looks as sync mode and 3-wire SPI:
UCB0CTLW0 |= UCSWRST; // Disable the USCI during configuration UCB0CTLW0 = ( (UCCKPH & 0) | // Sync. Mode: Clock Phase = 0 (UCCKPL & 0) | // Sync. Mode: Clock Polarity = 0 (UCMSB) // MSB first (UC7BIT & 0) | // 8 bits (UCMST) | // Sync. Mode: Master Select = 1 (UCMODE1 & 0) | // Sync. Mode 00: 3-pin SPI (UCMODE0 & 0) | (UCSYNC) | // Sync. Mode = SPI (UCSSEL1) | // Clock select: 11 = SMCLK (UCSSEL0) ); UCB0BRW = 8; //3686400L / 460800L - 1; PIN_AS_OUT_2ND( SPIMOSI_PORT, SPIMOSI_PIN); // SIMO (MOSI) pin P1.6 // P2SEL0 &= ~(1<<2); // P2SEL1 |= (1<<2); PIN_AS_OUT_2ND( SPICLK_PORT, SPICLK_PIN); // SCLK pin P2.2 PIN_AS_INP_2ND( SPIMISO_PORT, SPIMISO_PIN); // SOMI (MISO) pin P1.7 UCB0CTLW0 &= ~UCSWRST;
(Commented is the setting of clock pin without the macros - the result is the same)
Where am I wrong?
Additional info, may be irrelevant: the baudrate is set not according to manual
f BitClock = f BRCLK /(UCBRx+1)
Instead, the baud rate of series signal at the UCB0SIMO pin behaves as
f BitClock = f BRCLK /(UCBRx+0)
for all UCBRx > 0. I checked it experimentally with UCB0BRW register...
Regards,
Yura Vlasenko
Ukraine, Kyiv