This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430f2617 SPI_B1 CS is high while clock still active , error?

Genius 4170 points
Other Parts Discussed in Thread: MSP430F2617, TMP121, MSP430F5529

Hello,

long time I didnt have any further questions in the MSP430 which couldnt be solved by myself, but here I am back with another tricky one:

I do use the SPI_B1 on my MSP430F2617, that would be on Pins P5.1---5.3 or so, I state this cause mybe there is already an error.

I am pretty expirienced when it comes to SPI setting and so forth, so I am puzzeld here.

I am trying to shift out Temperature data from an TMP121 chip, this one only shifts out data if you pull down its CS and put in a clock, then it will give you back temperature in digital format, I did proof that in another setup with another MSP, the MSP430F5529 to be precise, everything works as planned.

Here is some snipped of my code:

unsigned char TMP121_ReceiveByte(void)
{
   unsigned char Result = 0;
   
    while(!(UCB1IFG&UCTXIFG));    // Make sure nothing is currently transmitting
    UCB1TXBUF = 0xff;             // Send out NOP to initiate SCLK
    while(!(UCB1IFG&UCRXIFG));    // Wait until all data is transmitted (received)
    Result = UCB1RXBUF;    // Capture the receive buffer
        
    return Result;
}

    P5OUT &= ~BIT4;


    int16_TempBin = TMP121_ReceiveByte();
    int16_TempBin = (int16_TempBin << 8);
    int16_TempBin |= TMP121_ReceiveByte();

    __no_operation();


    int16_TempBin = int16_TempBin >>3;
    f32_Temp= 0.0625*(int16_TempBin);
    TempSensor = f32_Temp;

    P5OUT |= BIT4;

So the code i sworking fine in the SPI B0 of the MSP430F5529 but it is not working correct in the MSP430F2617.

I am wondering if one is using the UART SPI and the other one the USCI sPI if there could be some different flags involved, since it is almost working fine but the last clock cycle.

Or maybe there is a known issue with the silicon???

I will try to fix an workaround by simply sending one more dummy byte, which i actually dont neew.

Any help appreciated.

Thanks.
seb

  • Did you intend to add a screenshot of the waveforms?
  • nope :) too much trouble

    Got the osci hooked up mybe later, until now, I do realize it does work with my max speed of 16MHz, slower it simply gives bad results, dont ask me why, I got no clues.

    So i will have it working with 16 MHz SPI clock, and see if the results will be satisfiying, or if i have to go through troubleshoot again, what mocks me a bit, my intended workaorund of simply sending one or 2 more bytes and therefore largening the cs low signal, does not give the right results either, it then cuts some of the high bits and my highest temperature ever will always be 30.0625 degree, since the higher bits are somehow ignored.

    And sorry for not posting any waveforms, this is cause of 2 reasons:
    1. i am simply lazy, and dont wanna store waveforms convert put them to PC then laod them up

    2. my expirience in here is simply that people did already expirience similar problems that i am explaining and can help without any further information, or my errors are simply well advanced and not that simple to solve, so an osciloscope pic wouldnt change a single bit :)

    But I always could be wrong aboutmy second reason of course
    cheers,
    seb

**Attention** This is a public forum