Part Number: MSP432P401R
Tool/software: Code Composer Studio
Hi guys, I have been using the MSP432 for a while now, and first of all I want to thank you all for all the great support you provide here.
Now to my issue, I'm programming the ADS1191 front end. At first, just for the tests, I was using the ACLK as a clock source for the SPI protocol, and it worked just fine. Now I'm trying to use the SMLCK as the clock source, I programmed it at 12 MHz because I need that speed for other peripherials, and I'm having trouble with the clock divider for the SPI, because I want to make it go at 1 MHz. This is the code I use for the clock.
void configCLK(void){ CS->KEY = CS_KEY_VAL; CS->CTL0 = 0x00; CS->CTL0 = CS_CTL0_DCORSEL_4; CS->CTL1 = CS_CTL1_SELA_2 | CS_CTL1_SELM_3 | CS_CTL1_SELS_3 | CS_CTL1_DIVS__2; CS->KEY = 0x00; }
And here is the one I use for the SPI protocol.
void configSPI(void){ EUSCI_B0->CTLW0 |= EUSCI_B_CTLW0_SWRST; EUSCI_B0->CTLW0 = EUSCI_B_CTLW0_SWRST | EUSCI_B_CTLW0_MST | EUSCI_B_CTLW0_SYNC | EUSCI_B_CTLW0_MSB; EUSCI_B0->CTLW0 |= EUSCI_B_CTLW0_SSEL__SMCLK; //EUSCI_B0->BRW = 12; EUSCI_B0->CTLW0 &= ~EUSCI_B_CTLW0_SWRST; EUSCI_B0->IFG &= ~(EUSCI_B_IFG_TXIFG | EUSCI_B_IFG_RXIFG); }
As you can see, I commented the BRW instruction, because it doesn't work. When I run my code like this, the communication has no problems, but I'm concerned because the ADS1191 datasheet says that the maximum clock speed is 2 Mhz, that's why I want it at 1 Mhz, but when I put the divider of the BRW register, the communication does't even start. I usually comment my code but I'm from México, so I erased the comments for easier interpretation.
Thanks, guys.