Jump to content

munny

Members
  • Content Count

    16
  • Joined

  • Last visited

1 Follower

About munny

  • Rank
    Member

Profile Information

  • Interests
    Embedded System

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello, Thank you for your response. Can you please explain what do you mean straight ADC values to serial output? How to do that? If you please explain, I can then try and confirm that it's working or not.
  2. Hello, I am trying to record my voice using MSP430F5438A onboard microphone. So as a starting point I am reading the microphone data(Channel 5, ADC12). I am sending the data directly to PC and observing the output at tera term. But I am confused seeing the ADC output. After a certain amount of data, the value saturates and actually doesn't change at all even if I speak or make a sound. I don't catch where I'm doing wrong. I'm attaching my code and the data output snapshot. Any suggestion is highly appreciated. #include <msp430.h> unsigned int voice; volatile unsigned char volt [5]; void init_serial (void); void init_serial (void) { P5SEL |= 0xC0; // 5.6 and 5.7 for TX/RX- UCA1 UCA1CTL1 |= UCSWRST; UCA1CTL1 |= UCSSEL_1; //32768 Hz UCA1BR0 = 03; // Baudrate 9600 UCA1BR1 = 0x00; UCA1MCTL = 0x06; // Modulation Sx=3, Fx= 0 UCA1CTL0 = 0x00; UCA1CTL1 &= ~UCSWRST; // In operation mode } void ADC_value (int); void ADC_value (int ADC_Data) { volatile char x=3; volt [3] = volt [2] = volt [1] = volt [0] = 0x30; while (ADC_Data > 0) { volt [x] = (ADC_Data%10)| 0x30; // Separating unit digit ADC_Data = ADC_Data/10; // rest of the digit than last digit x--; } volt [4] = '\0'; } void Send_Serial (void); void Send_Serial (void) { volatile char i=0; while (volt[i] != '\0') { UCA1TXBUF = volt[i]; while (UCA1STAT & UCBUSY); i++; } UCA1TXBUF = 0x0a; while (UCA1STAT & UCBUSY); UCA1TXBUF = 0x0d; while (UCA1STAT & UCBUSY); } int main(void) { P6OUT |= BIT4; // microphone power P6OUT &= ~BIT5; // microphone connected at input channel 5 P6SEL |= BIT5; WDTCTL = WDTPW + WDTHOLD; // Stop WDT /* Initialize the shared reference module */ REFCTL0 |= REFMSTR + REFVSEL_0 + REFON; // Enable internal 1.5V reference /* Initialize ADC12_A */ ADC12CTL0 &= ~ADC12ENC; // Ensure ENC ADC12CTL0 = ADC12ON + ADC12SHT02; // Set sample time ADC12CTL1 = ADC12SHP + ADC12SSEL_3; // Enable sample timer ADC12MCTL0 = ADC12INCH_5; // ADC input ch A5 => MIC init_serial (); while (1) { ADC12CTL0 &= ~ADC12SC; ADC12CTL0 |= ADC12SC + ADC12ENC; while (ADC12CTL1 & ADC12BUSY) __no_operation(); voice = ADC12MEM0; ADC_value (voice); Send_Serial (); } } User guide: http://www.ti.com/lit/ug/slau263i/slau263i.pdf
  3. Hello, I am trying to collect data from the following optical dust sensor: https://www.sparkfun.com/datasheets/Sensors/gp2y1010au_e.pdf According to page 5 of the datasheet, I generated the correct PWM signal using timer A for input PIN 3 of the sensor and observed the signal in my oscilloscope. Now at the same page Figure 2, they talked about the output pulse sample timing. Anyone can help me understand how should I set up my ADC12 for this? Few queries regarding this: 1. Should my sample and hold time be 0.28ms? 2. If so then should I wait for next 0.04ms + 9.68ms to collect my next ADC value as the next input pulse needs that much time to arrive? 3. If 1 and 2 are correct, how can I set up my ADC for this? Just for information, I am using MSP430F5438A, IDE: Code Composer Studio Thanks, Row
  4. Hello, I'm trying to write to a file and then reading back from it. I'm using code composer studio. After execution, I can see a file is created but nothing is written in it (Didn't get any error). Below is the code. What is the possible issue here? I omit the reading part as I couldn't able to write. #include <msp430.h> #include <stdio.h> void main() { WDTCTL = WDTPW + WDTHOLD; // Stop WDT FILE *fread; fread= fopen("testing", "w"); // not sure if I should add the file extention here like testing.txt but I tried including the extension also fprintf(fp, "Writing\n"); fclose(fp); } Thanks, Row
  5. Yes, I looked for the separate MIC options. And yes you are right Spark fun and Adafruit has their breakout boards. I'll probably go for those for my project. Thanks for your response.
  6. I really appreciate your time for the writing. It's very informative. Yes, you are correct about the MIC choice. I actually haven't think about that details still regarding the practical challenges. Especially with my system (Has other sensors in it), it will be very challenging. For data processing, I am dealing with MATLAB also. I'll follow the blog you referred also for getting further idea. Thanks a lot.
  7. I haven't decided yet. I just read a paper where the respiration rate is calculated with speech recording. That's why thinking if I can utilize the microphone from the board I have. Thanks for your response.
  8. Hello, I am planning to analyze breathing pattern using a microphone. I have MSP430F5438A Experimental board. I found that the board itself has a microphone. I am looking for any documentation available about how to use the microphone from the board. I did a little bit of research but didn't find details other than the user guide for the board. I appreciate any recommendation. Thanks, Row
  9. Hello mph, Thank you for your time and response. I'll follow the instruction you have given and will let you know if that works. So I read the burst read case in the datasheet but confused seeing the pseudo-code format on page 17. In that code, they read all the sample available at a time. I am sorry for not being more clear. I am trying to develop the code from scratch. At his point my concern is reading RED, IR and GREEN LED data in real time. I am going to implement UART to observe the data. But as I am stuck in getting the number of available samples to read, that's why I trim my code and omit the UART part for now.
  10. Hello, I am trying to get RED, IR and GREEN led value in real time from MAX30101 sensor. I am using MSP430F5438A as my MCU. My IDE is CCS. The protocol required to communicate with the sensor is I2C. Now my problem is I am not any value except 0 in my read and write pointer (Indicated in the comment in my code). I am supposed to get some value in between 0 to 32. I'm attaching the link for the datasheet for the sensor: https://datasheets.maximintegrated.com/en/ds/MAX30101.pdf I know the datasheet is a whole lot. But I am referring page 17 which they have a pseudo code how to burst read the FIFO. If anyone already worked with the sensor or anyone know please have a look at it. #include <msp430.h> #include <msp430f5438a.h> #include <string.h> #define MAX30101_I2C_ADDRESS 0x57 #define MAX30101_REG_INT_STS1 0x00 #define MAX30101_REG_INT_STS2 0x01 #define MAX30101_REG_INT_EN1 0x02 #define MAX30101_REG_INT_EN2 0x03 #define MAX30101_REG_FIFO_WR 0x04 #define MAX30101_REG_FIFO_OVF 0x05 #define MAX30101_REG_FIFO_RD 0x06 #define MAX30101_REG_FIFO_DATA 0x07 #define MAX30101_REG_FIFO_CFG 0x08 #define MAX30101_REG_MODE_CFG 0x09 #define MAX30101_REG_SPO2_CFG 0x0a #define MAX30101_REG_LED1_PA 0x0c #define MAX30101_REG_LED2_PA 0x0d #define MAX30101_REG_LED3_PA 0x0e #define MAX30101_REG_PILOT_PA 0x10 #define MAX30101_REG_MULTI_LED 0x11 #define MAX30101_REG_TINT 0x1f #define MAX30101_REG_TFRAC 0x20 #define MAX30101_REG_TEMP_CFG 0x21 #define MAX30101_REG_PROX_INT 0x30 void Clock_setup(); // default void MAX30101_setup(); // Sensor config setup void I2C_setup(); void sendByte(char register_add, char data); int readByte(char wr_add, char rd_add, char register_add); void burstRead(char wr_add, char rd_add, char register_add, int no_ofsample); void FIFO_Clear(); char LED1 [96]; char LED2 [96]; char LED3 [96]; long L1[32]; long L2[32]; long L3[32]; int wr; int rd; int Ns; // number of available sample void main() { WDTCTL = WDTPW + WDTHOLD; Clock_setup(); I2C_setup(); _EINT(); MAX30101_setup(); while(1){ //FIFO_Clear(); wr= readByte(0xAE, 0xAF, 0x04); // reading WR_PTR---> I don't know why getting zero rd= readByte(0xAE, 0xAF, 0x06); // reading RD_PTR---> I don't know why getting zero Ns = wr-rd; if(Ns<0){ Ns+=32; } if(wr != rd){ burstRead(0xAE, 0xAF, 0x07, Ns); } } } void Clock_setup(){ P11DIR |= BIT2; // check smclk, 1MHz default P11SEL |= BIT2; // check smclk, 1MHz default P11DIR |= BIT0; // check aclk, 32.8KHz default P11SEL |= BIT0; // check aclk, 32.8KHz default } void I2C_setup() { P3SEL |= BIT7; // P3.1(UCB0_SDA), P3.2(UCB0_SCL) P5SEL |= BIT4; UCB1CTL1 |= UCSWRST; // reset enable UCB1CTL0 = UCMST + UCMODE_3 + UCSYNC; // master + I2C mode + Sync UCB1CTL1 = UCSSEL_2 + UCSWRST; //use SMCLK + still reset UCB1BR0 = 10; // default SMCLK 1M/10 = 100KHz.........? UCB1BR1 = 0; // UCB1I2CSA = MAX30101_I2C_ADDRESS; // MAX30101 7 bit address 0x57 UCB1CTL1 &= ~UCSWRST; // reset clear // UCB1IE |= UCTXIE + UCRXIE; //TX and RX interrupt enabled } //Single Byte Transmit (TX) void sendByte(char register_add, char data){ // UCB0I2CSA = slave_add; //slave address for transmit mode UCB1CTL1 |= UCTR + UCTXSTT; // I2C transmit (write) mode + generating START condition UCB1TXBUF = register_add; //register address to measure temperature/pressure while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent while(UCB1CTL1 & UCTXSTT); //wait till START condition is cleared UCB1TXBUF = data; //send data to register while(!(UCB1IFG & UCTXIFG)); //wait until data got sent UCB1CTL1 |= UCTXSTP; //generate a STOP condition while(UCB1CTL1 & UCTXSTP); //wait until stop condition got sent } //Single Byte Receive (RX) int readByte(char wr_add, char rd_add, char register_add){ int rx_byte; //UCB0I2CSA = slave_add; //slave address UCB1CTL1 |= UCTXSTT + UCTR; // Generating START + I2C transmit (write) UCB1TXBUF = wr_add; //write register address while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent UCB1TXBUF = register_add; //write register address while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent while( UCB1CTL1 & UCTXSTT); //wait till START condition is cleared UCB1CTL1 |= UCTXSTT; //generate RE-START //UCB1I2CSA = slave_add; //slave address UCB1TXBUF = rd_add; //write register address while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent UCB1CTL1 &=~ UCTR; //receive mode while( UCB1CTL1 & UCTXSTT); //wait till START condition is cleared rx_byte = UCB1RXBUF; //read byte UCB1CTL1 |= UCTXSTP; //generate stop condition while(UCB1CTL1 & UCTXSTP); //wait till stop condition got sent return rx_byte; } //Multiple Byte Receive (RX) void burstRead(char wr_add, char rd_add, char register_add, int no_ofsample){ unsigned int i; //UCB1I2CSA = slave_add; //slave address //while(!(UCB1IFG & UCTXIFG)); //wait until slave address got sent UCB1CTL1 |= UCTXSTT + UCTR; // Generating START condition + I2C transmit (write) UCB1TXBUF = wr_add; //write register address while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent UCB1TXBUF = register_add; //write register address while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent while( UCB1CTL1 & UCTXSTT); //wait till START condition is cleared UCB1CTL1 |= UCTXSTT; //generate RE-START condition //UCB1I2CSA = slave_add; //slave address UCB1TXBUF = rd_add; //write register address while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent UCB1CTL1 &=~ UCTR; //receive mode while( UCB1CTL1 & UCTXSTT); //wait till START condition is cleared //buffer[0] = UCB1RXBUF; //dummy read //while(!(UCB1IFG & UCRXIFG)); //wait till byte is completely read for(i=0;i<no_ofsample;++i){ LED1 = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED1[i+1] = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED1[i+2] = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read L1= ((LED1 << 16) | (LED1[i+1] << 08 | LED1[i+2]) & 0x03FFFF; LED2 = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED2[i+1] = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED2[i+2] = UCB1RXBUF; //burst read L2= ((LED2 << 16) | (LED2[i+1] << 08 | LED2[i+2]) & 0x03FFFF; while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED3 = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED3[i+1] = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED3[i+2] = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read L3= ((LED3 << 16) | (LED3[i+1] << 08 | LED3[i+2]) & 0x03FFFF; } //buffer[no_ofBytes-1] = UCB1RXBUF; //last Byte read //while(!(UCB1IFG & UCRXIFG)); //wait UCB1CTL1 |= UCTXSTP; //generate stop condition //while(UCB1CTL1 & UCTXSTP); //wait till stop condition got sent } // Sample Average = 4 // Mode = MultiLED // ADC Range = 2048 // Sample rate = 400 //pulse width = 411 // active slot 01, 02 and 03 void MAX30101_setup(){ sendByte(0x08, 0x40); sendByte(0x09, 0x07); sendByte(0x0A, 0x0F); sendByte(0x11, 0x77); sendByte(0x12, 0x07); } void FIFO_Clear(){ sendByte(0x04, 0x00); sendByte(0x05, 0x00); sendByte(0x06, 0x00); } Thanks, Rowshon.
  11. Trying to work with SPPDemo (MSP430F5438A+ CC2564B) according to the steps described at the link below: http://processors.wiki.ti.com/index.php/CC256x_TI_Bluetooth_Stack_SPPDemo_App I was able to open the server. But on the client side, I can't see the device list with DisplayInquiryList Command. I tried Inquiry command before it to initialize the process. Both the pictures of server and client are added.
  12. Hello, I am looking for a Bluetooth module which I can work with MSP430F5438A (Microcontroller). I am using Code Composer Studio (CCS) IDE. I searched Google a bit and also went through TI web pages about the possible module. I was wondering if anybody can suggest any module which I can work with that specific micro-controller? Other issue is please suggest a module which has enough documents and demo project (Possibly in CCS) to get started and go further. Thanks, Rowshon.
  13. Hello, So, the libraries available has specific things of the sensor. Do you think those libraries work with the Energia when ported? If so, what should be the possible changes? Thanks!
  14. Hello, Can anyone help me with the source code for the pulse oximeter of the MAX30100 sensor (I2C communication)? Following is the datasheet: https://datasheets.maximintegrated.com/en/ds/MAX30100.pdf I'm using MSP430F5438A. Thanks.
  15. Actually, I am using the AD8232 sensor that has 3 electrodes. I don't think I'll get better data than that (Might get a little bit better). So I need to do filtering to remove the noise. Do you have any idea how to do that processing in MSP430? Thanks for your response.
×
×
  • Create New...