Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 63880

Forum Post: CCS/MSP430FR6879: MSP430FR6879 SPI SLAVE Restarting when trying to transmit

$
0
0
Part Number: MSP430FR6879 Tool/software: Code Composer Studio i am using msp430fr6879 as spi slave wherein my master would be continously sending the clock pulse all the time , i only enable my interrupt when required to transmit or receive data . here is my code kindly look into it .. #include #include #include #include "SPI_SendReceive.h" //#include "globleParam.h" #include "structure.h" volatile unsigned char commState; volatile unsigned char rxCmd; Tank_Config_struct bTankConfig; long modbusCRCAddition(unsigned char * arr, int bSize); char* itoah(long num, char * s, int len); void BOS_DataParsing(void); void FillTankConfiguration(void); unsigned long int readNumber(unsigned char * arr, int size); void readString(unsigned char * arr, int size, unsigned char * getArr); volatile unsigned int rxCount=0, txCount=0; volatile unsigned char *txPtr; volatile unsigned char rxBuff[rxtxBuffSize], txBuff[rxtxBuffSize], tmpChar; unsigned char rxData[rxtxBuffSize], txData[rxtxBuffSize]; void BOS_SendReceiveFunction(void) { if(UCB0STATW & UCOE) tmpChar= UCB0RXBUF; if(commState==Received) { //IE2 &=~UCB0RXIE; // Interrupt disable char crcData[4]; int j; for(j=0; j > 1) & 0x7FFF; if(CRCLSB==1) CRCFull = CRCFull ^ 0xA001; } } return (CRCFull); } char* itoah(long num, char* s, int len) { long n, m = 16; int i = 16+2; int shift = 'a'- ('9'+1); if(!s || len i ? i : len; i = len '9') s[i-1] += shift ; n = n/m; i--; } if(num 6) { commState=Received; //UCB0CTLW0 |= UCSWRST; UCB0IE &=~UCRXIE; } else commState=Ideal; } else if(rxCount >= rxtxBuffSize) commState=Ideal; } else if(commState==Received | commState==ReadyToProcess) { UCB0TXBUF=0; tmpChar=UCB0RXBUF; } else if(commState==Transmit) { if((UCB0IFG & UCTXIFG)== UCTXIFG); { UCB0TXBUF=*txPtr; if(txCount>0) txCount--; if(txCount==1) { } if(txCount==0) commState=Ideal; } } } }

Viewing all articles
Browse latest Browse all 63880

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>