Quantcast
Channel: Data converters
Viewing all 89308 articles
Browse latest View live

Forum Post: RE: ADS1248: Connecting three 3-Wire TPM100

$
0
0
Noam, I'm not sure what a TPM100 is, but you are referring to an PT100 RTD? If so then, yes you could measure up to four of these devices. However, there are limitations. I'll explain how this is setup, what some of the limitations are and what other options you have. Using the ADS1248 you could measure up to four 3-wire RTDs. Here is the setup that you would use: Looking at the diagram, you can see each RTD element in a dashed box. The three extra resistors shown represent the lead wire resistance (shaded in gray). When measuring each RTD, you would source current with the IDACs into each RTD individually. The lead resistances reacting with the IDAC currents cancel assuming that the IDAC currents and the lead resistances match. The RTD sees the current from IDAC1. The reference voltage be R REF *(I IDAC1 +I IDAC2 ). This becomes a ratiometric measurement where the ADC output code would be proportional to R RTD /(2*R REF ) However, many people will not use this topology because noise may be a problem and input filtering may help. Using input filtering, only two 3-wire RTDs can be measured. This next figure shows how this topology is put together. With this topology, we inject the IDAC currents into the RTD with external pins, bypassing the filter. In the previous example, we injected current into the RTD from IDACs connected to the input pins. With an external filter, it's extremely unlikely that the filter resistances will match enough to directly cancel out the lead resistances. I would note there is an extra set of input pins that can be used to make an alternate measurement. If there is something else that needed to be measured, then AIN6 and AIN7 would be available. If you need the filtering and would still like to use a single device, one other possibility would be to use the ADS124S08 . This device has more pins connected to the input multiplexer. You would connect the device shown below. Unlike the ADS1248 , in the ADS124S08 , there are no dedicated IDAC output pins (although on both devices, unused input pins can be used for the IDAC). I hope this answers your question. If you have additional questions, or if I've completely misunderstood your question, please feel free to post back. Joseph Wu

Forum Post: RE: DAC3484EVM: Connection to a Xlinx Board

$
0
0
Jim, May I ask this in another way? I would like to know which type of FMC connector that the FMC-DAC-Adapter ( http://www.ti.com/tool/fmc-dac-adapter ) and the

Forum Post: RE: ADS1262: Unable to capturing serial data coming DOUT/DRDY pin

$
0
0
Hi Shambhu, Thanks for sharing the additional information and screenshots! From my perspective it would appear like the ADS1262 is responding correctly. Therefore, is the issue your having that the FPGA is not reading the same data as seen on the oscilloscope or that the data is not making sense? I'm sorry, I'm not quite sure I understand the problem. One thing I noticed, you appear to only send 32 SCLKs when reading the data. However, with the default register settings you will need to send a total of 48 SCLKs to clock out the STATUS, DATA, and CRC bytes (as shown below). At the moment you may only be getting the STATUS, DATA1, DATA2, and DATA3 bytes.... Another thing to check would be the SPI mode your using. The ADS1262 uses SPI mode 1 (CPOL=0, CPHA=1); therefore, make sure you are reading the data on falling edge of SCLK. The /DRDY behavior also looks correct...It typically goes low when a conversion is completed and then returns after after the first SCLK. So I don't see any issues there. Aside: From the oscilloscope screenshot the first byte back from the ADS1262 is the STATUS byte, and it appears to have the value of 0x69. This would indicate that the conversion data is new, that you're using an external clock, and that the input voltage is violating the PGA's common-mode voltage (low-side). This makes sense, because you've connected the negative input to ground. To ensure linear PGA operation, you will need to apply a higher voltage to AIN1 or bypass the PGA. Best Regards, Chris

Forum Post: RE: TSW1200EVM vhdl

$
0
0
Eli, when you say non-related to a specific design, I am guessing that our source code for the LVDS parallel bus format would be best suited. The source code defines inputs to the FPGA for all the possible LVDS pairs that are listed in the schematics for the TSW1200 connector regardless of whether a specific EVM uses those inputs or leaves them floating. Also the zip file includes the ucf file. There are a few examples of timing constraint in the UCF for the DDR inputs, with one example for a source synchronous timing such as from our ADS5463 EVM and the other for a source centered timing such as our ADS6149 . But I believe Xilinx has changed the syntax since then for handing the DDR timing constraints. The other design database I could have sent would have been for our pseudo-serialized format such as our ADS5281 , and the constraint file for that lists only as many as 10 LVDS inputs for just those inputs that are used by our highest channel count device. Anyway, if you would provide an email address to send it to I can send that out. Regards, Richard P.

Forum Post: DAC8552: DAC8552 gives only zero or full scale output

$
0
0
Part Number: DAC8552 Hello, right now I am trying to write an output value with a STM32F407 to the DAC8552 via SPI. According to the datasheet register description the DAC should change the value. But it only gives back full scale or zero scale. The transmitted data also seem to be right. Right now the DAC is mounted on a breakout board. It's supplied with 5V from a lab psu. For first tests I tied V_ref to the supply voltage. My SPI has the following configuration: Mode: Master Clock Frequency = 10MHz Dataframe Size : 8bit CPOL: 0 CPHA: 1 Firstbit: MSB CRC: Disabled In my software I am writing simply two different values into DAC A with a 100ms delay in between. Just fyi the function HAL_SPI_Transmit sends n bytes defined by its third parameter. uint8_t byte1[3]; uint8_t byte2[3]; bytes1[0] = 0x10; bytes1[1] = 0xAA; bytes1[2] = 0x00; bytes2[0] = 0x10; bytes2[1] = 0x20; bytes2[2] = 0x00; HAL_GPIO_WritePin(SPI_CS1_GPIO_Port, SPI_CS1_Pin, GPIO_PIN_SET); // SYNC=High while (1){ HAL_GPIO_WritePin(SPI_CS1_GPIO_Port, SPI_CS1_Pin, GPIO_PIN_RESET); // SYNC=Low HAL_SPI_Transmit(&hspi1, (uint8_t *)&bytes1, 3, 100); // send each element of bytes1 HAL_GPIO_WritePin(SPI_CS1_GPIO_Port, SPI_CS1_Pin, GPIO_PIN_SET); // SYNC=High HAL_Delay(100); HAL_GPIO_WritePin(SPI_CS1_GPIO_Port, SPI_CS1_Pin, GPIO_PIN_RESET); // SYNC=Low HAL_SPI_Transmit(&hspi1, (uint8_t *)&bytes2, 3, 100); // send each element of bytes2 HAL_GPIO_WritePin(SPI_CS1_GPIO_Port, SPI_CS1_Pin, GPIO_PIN_SET); // SYNC=High HAL_Delay(100); } Did you know about such issues with the DAC8552 and a STM32Fxx? Do you have any idea what might be wrong? Kind regards, Simon

Forum Post: RE: ADS1256 and Python compatibility. Problems with SPI.

$
0
0
Hi Felix, I tried to run your new code and I get the same error where the kernel crashes and restarts the shell on the "soc.bcm2835_spi_setDataMode(soc.BCM2835_SPI_MODE1)" line. I fear I am making a basic error. To answer your previous questions: > "You probably will get a crash even if your code only just first mentions the bcm2835 library. " The "import libbcm2835._bcm2835 as soc" seems to be fine and returns no error. Also it will process through "soc.bcm2835_spi_setBitOrder(soc.BCM2835_SPI_BIT_ORDER_LSBFIRST )" before it trips up on the following line. I believe I am running v1.50 from www.airspayce.com/.../ One thing I had issues with from the instructions was finding if my device tree was enabled. It seems that rpi3/jessie no longer has advanced options? And I could not find a thread anywhere that addressed how to enable the device tree through jessie. "sudo raspi-config under Advanced Options - enable Device Tree Reboot. > Do you see libbcm2835 in your usr/local/lib/python2.7 folder? I have libbcm2835 in my usr/local/lib/python2.7/dist-packages folder. > "You might have to check if the library files are installed in the right place. " If I had my library files installed in the wrong place, wouldn't I get an error when I imported libbcm2835? Anyways, if you'll let me try your c code, perhaps I'll have better luck? Cheers, gr8

Forum Post: RE: ADS1248: Connecting three 3-Wire TPM100

$
0
0
Noam, I'm sure that you could use some sort of 2:6 multiplexer, but I'm well versed on which to use. I'll do some searching around and post back. In the meantime, let me describe what might be important in the recommendation. First, you shouldn't care much about what the mux series resistance is. Low resistance is great but in the end, the mux only routs the current, and series resistance won't be part of the measurement. The important thing is that the mux leakage must be very low. Any leakage takes away current from the RTD and reference resistance. This can cause an apparent gain error. Also, if you need to consider the operating temperature of the circuit. Often leakage currents are higher at high temperatures. There are two other things to note in the diagrams that I showed you. First, the accuracy of the reference resistor is important. Any error in this also appears as a gain error in the measurement. With the reference resistor, you will want a precision resistor with good accuracy and low drift. Second, this reference resistance also acts to level shift the input measurement. The PGA used in the ADC may not have a large input range of operation (and it may get smaller as the PGA gain is larger). The reference resistor is often used to shift the input signal up so that it is within the input range of the PGA. Joseph Wu

Forum Post: RE: can anyone share audio reference design

$
0
0
Hi, Satyanarayana, Thanks for your question, could you please provide more information about your application so we can find the best solution for you?. A block diagram would be useful. Best Regards, -Diego Meléndez López Audio Applications Engineer

Forum Post: RE: ADS1256 and Python compatibility. Problems with SPI.

$
0
0
hello gr8, I am sorry this isn't working for you so far. So you are saying the code crashes on the setDataMode line? This does sound like a problem with communicating with the board. Have you been able to run the example c-code from waveshare? www.waveshare.com/.../DA_Board From this I was able to at least verify that the hardware was okay. Also, I can't remember if I had to change the jumper settings from what it was when it was shipped to me. Here is what the manual says for using the digital to analog conversion: >>Jumper settings: >>Set the Power Supply to 5V: connect the pin 5V and VCC. >>Set the Reference Input Voltage to 5V: connect the pin 5V and VREF. >>Connect the pin DA0 to LEDA, the pin DA1 to LEDB. Then the brightness of LEDA indicator will be changed according to the voltage output of >>DA0 and the brightness of LEDB indicator will be changed according to the voltage output of DA1. If the example code works, then I would skip over to my c code with python calling function. See below. If not, then maybe there's still something wrong with pi settings. I am also running Jessie, but on a raspberry pi 2. My raspi-config still shows the Device Tree Option. I found some documentation that told me that /boot/config.txt should have a line that says "device_tree= ". Otherwise it's on by default. I found another forum that recommends adding an explicit line for the waveshare. www.raspberrypi.org/.../viewtopic.php . I don't have this but maybe its needed for pi 3? If you can't get any of this to work on pi 3, maybe you should borrow someone's pi 2. I can send you a copy of my disk image if you like. I couldn't find a way to attach my python and c-code, so let me try pasting them here: #python_c_test.py from myModule import * import time print("Intialize AD/DA Board", myInitFunction()) to=time.time() delT=0.001; ii=0; init=0 while (ii =0.001: if ii>0: init=1 sensors=myMainFunction(init, 5.0) to=t1 print("Result:", sensors, "time:",delT) ii=ii+1 print("Closing Communication", myClosingFunction()) #End of Python File //myModule.c //To compile this file: //gcc -shared -lbcm2835 -I/usr/include/python2.7/ -lpython2.7 -o myModule.so myModule.c //This c-code can be compiled to provided a library file usable by python 2.x //It is designed to return 1 sample of 8 channels. //The following is nearly verbatim from ADS1256 _test.c supplied from WAVESHARE company. //This code was a demo that allows 8-channels from the ADC to be read and output to screen //We will moslty have a lot of function definitions before we get to the modifications for Python //The main change is to split the Main function into an initialization phase and a running phase. //The motivation for this design is so that Python can start intialization, then asks for data //only as needed. The c-functionality can then exit without holding up the python script. //We will mark New Code and Orginal Code //This include line for Python needs to come first according to python documentation //New Code //Including this file could be tricky. My compile environment did not know where it was //so I had to specify its location manually #include //Original Code //Note all the orginal functions were dropped in here unmodified //Look for next instance of New Code #include #include #include #include #include #include #include #include //CS ----- SPICS //DIN ----- MOSI //DOUT ----- MISO //SCLK ----- SCLK //DRDY ----- ctl_IO data starting //RST ----- ctl_IO reset #define DRDY RPI_GPIO_P1_11 //P0 #define RST RPI_GPIO_P1_12 //P1 #define SPICS RPI_GPIO_P1_15 //P3 #define CS_1() bcm2835_gpio_write(SPICS,HIGH) #define CS_0() bcm2835_gpio_write(SPICS,LOW) #define DRDY_IS_LOW() ((bcm2835_gpio_lev(DRDY)==0)) #define RST_1() bcm2835_gpio_write(RST,HIGH); #define RST_0() bcm2835_gpio_write(RST,LOW); /* Unsigned integer types */ #define uint8_t unsigned char #define uint16_t unsigned short #define uint32_t unsigned long typedef enum {FALSE = 0, TRUE = !FALSE} bool; /* gain channelî */ typedef enum { ADS1256 _GAIN_1 = (0), /* GAIN 1 */ ADS1256 _GAIN_2 = (1), /*GAIN 2 */ ADS1256 _GAIN_4 = (2), /*GAIN 4 */ ADS1256 _GAIN_8 = (3), /*GAIN 8 */ ADS1256 _GAIN_16 = (4), /* GAIN 16 */ ADS1256 _GAIN_32 = (5), /*GAIN 32 */ ADS1256 _GAIN_64 = (6), /*GAIN 64 */ } ADS1256 _GAIN_E; /* Sampling speed choice*/ /* 11110000 = 30,000SPS (default) 11100000 = 15,000SPS 11010000 = 7,500SPS 11000000 = 3,750SPS 10110000 = 2,000SPS 10100001 = 1,000SPS 10010010 = 500SPS 10000010 = 100SPS 01110010 = 60SPS 01100011 = 50SPS 01010011 = 30SPS 01000011 = 25SPS 00110011 = 15SPS 00100011 = 10SPS 00010011 = 5SPS 00000011 = 2.5SPS */ typedef enum { ADS1256 _30000SPS = 0, ADS1256 _15000SPS, ADS1256 _7500SPS, ADS1256 _3750SPS, ADS1256 _2000SPS, ADS1256 _1000SPS, ADS1256 _500SPS, ADS1256 _100SPS, ADS1256 _60SPS, ADS1256 _50SPS, ADS1256 _30SPS, ADS1256 _25SPS, ADS1256 _15SPS, ADS1256 _10SPS, ADS1256 _5SPS, ADS1256 _2d5SPS, ADS1256 _DRATE_MAX } ADS1256 _DRATE_E; #define ADS1256 _DRAE_COUNT = 15; typedef struct { ADS1256 _GAIN_E Gain; /* GAIN */ ADS1256 _DRATE_E DataRate; /* DATA output speed*/ int32_t AdcNow[8]; /* ADC Conversion value */ uint8_t Channel; /* The current channel*/ uint8_t ScanMode; /*Scanning mode, 0 Single-ended input 8 channel£¬ 1 Differential input 4 channel*/ } ADS1256 _VAR_T; /*Register definition£º Table 23. Register Map --- ADS1256 datasheet Page 30*/ enum { /*Register address, followed by reset the default values */ REG_STATUS = 0, // x1H REG_MUX = 1, // 01H REG_ADCON = 2, // 20H REG_DRATE = 3, // F0H REG_IO = 4, // E0H REG_OFC0 = 5, // xxH REG_OFC1 = 6, // xxH REG_OFC2 = 7, // xxH REG_FSC0 = 8, // xxH REG_FSC1 = 9, // xxH REG_FSC2 = 10, // xxH }; /* Command definition£º TTable 24. Command Definitions --- ADS1256 datasheet Page 34 */ enum { CMD_WAKEUP = 0x00, // Completes SYNC and Exits Standby Mode 0000 0000 (00h) CMD_RDATA = 0x01, // Read Data 0000 0001 (01h) CMD_RDATAC = 0x03, // Read Data Continuously 0000 0011 (03h) CMD_SDATAC = 0x0F, // Stop Read Data Continuously 0000 1111 (0Fh) CMD_RREG = 0x10, // Read from REG rrr 0001 rrrr (1xh) CMD_WREG = 0x50, // Write to REG rrr 0101 rrrr (5xh) CMD_SELFCAL = 0xF0, // Offset and Gain Self-Calibration 1111 0000 (F0h) CMD_SELFOCAL= 0xF1, // Offset Self-Calibration 1111 0001 (F1h) CMD_SELFGCAL= 0xF2, // Gain Self-Calibration 1111 0010 (F2h) CMD_SYSOCAL = 0xF3, // System Offset Calibration 1111 0011 (F3h) CMD_SYSGCAL = 0xF4, // System Gain Calibration 1111 0100 (F4h) CMD_SYNC = 0xFC, // Synchronize the A/D Conversion 1111 1100 (FCh) CMD_STANDBY = 0xFD, // Begin Standby Mode 1111 1101 (FDh) CMD_RESET = 0xFE, // Reset to Power-Up Values 1111 1110 (FEh) }; ADS1256 _VAR_T g_tADS1256; static const uint8_t s_tabDataRate[ ADS1256 _DRATE_MAX] = { 0xF0, /*reset the default values */ 0xE0, 0xD0, 0xC0, 0xB0, 0xA1, 0x92, 0x82, 0x72, 0x63, 0x53, 0x43, 0x33, 0x20, 0x13, 0x03 }; void bsp_DelayUS(uint64_t micros); void ADS1256 _StartScan(uint8_t _ucScanMode); static void ADS1256 _Send8Bit(uint8_t _data); void ADS1256 _CfgADC( ADS1256 _GAIN_E _gain, ADS1256 _DRATE_E _drate); static void ADS1256 _DelayDATA(void); static uint8_t ADS1256 _Recive8Bit(void); static void ADS1256 _WriteReg(uint8_t _RegID, uint8_t _RegValue); static uint8_t ADS1256 _ReadReg(uint8_t _RegID); static void ADS1256 _WriteCmd(uint8_t _cmd); uint8_t ADS1256 _ReadChipID(void); static void ADS1256 _SetChannal(uint8_t _ch); static void ADS1256 _SetDiffChannal(uint8_t _ch); static void ADS1256 _WaitDRDY(void); static int32_t ADS1256 _ReadData(void); int32_t ADS1256 _GetAdc(uint8_t _ch); void ADS1256 _ISR(void); uint8_t ADS1256 _Scan(void); void bsp_DelayUS(uint64_t micros) { bcm2835_delayMicroseconds (micros); } /* ********************************************************************************************************* * name: bsp_InitADS1256 * function: Configuration of the STM32 GPIO and SPI interface£¬The connection ADS1256 * parameter: NULL * The return value: NULL ********************************************************************************************************* */ void bsp_InitADS1256(void) { #ifdef SOFT_SPI CS_1(); SCK_0(); DI_0(); #endif // ADS1256 _CfgADC( ADS1256 _GAIN_1, ADS1256 _1000SPS); /* ÅäÖÃADC²ÎÊý£º ÔöÒæ1:1, Êý¾ÝÊä³öËÙÂÊ 1KHz */ } /* ********************************************************************************************************* * name: ADS1256 _StartScan * function: Configuration DRDY PIN for external interrupt is triggered * parameter: _ucDiffMode : 0 Single-ended input 8 channel£¬ 1 Differential input 4 channe * The return value: NULL ********************************************************************************************************* */ void ADS1256 _StartScan(uint8_t _ucScanMode) { g_tADS1256.ScanMode = _ucScanMode; /* ¿ªÊ¼É¨Ãèǰ, ÇåÁã½á¹û»º³åÇø */ { uint8_t i; g_tADS1256.Channel = 0; for (i = 0; i > 4); } /* ********************************************************************************************************* * name: ADS1256 _SetChannal * function: Configuration channel number * parameter: _ch: channel number 0--7 * The return value: NULL ********************************************************************************************************* */ static void ADS1256 _SetChannal(uint8_t _ch) { /* Bits 7-4 PSEL3, PSEL2, PSEL1, PSEL0: Positive Input Channel (AINP) Select 0000 = AIN0 (default) 0001 = AIN1 0010 = AIN2 ( ADS1256 only) 0011 = AIN3 ( ADS1256 only) 0100 = AIN4 ( ADS1256 only) 0101 = AIN5 ( ADS1256 only) 0110 = AIN6 ( ADS1256 only) 0111 = AIN7 ( ADS1256 only) 1xxx = AINCOM (when PSEL3 = 1, PSEL2, PSEL1, PSEL0 are ¡°don¡¯t care¡±) NOTE: When using an ADS1255 make sure to only select the available inputs. Bits 3-0 NSEL3, NSEL2, NSEL1, NSEL0: Negative Input Channel (AINN)Select 0000 = AIN0 0001 = AIN1 (default) 0010 = AIN2 ( ADS1256 only) 0011 = AIN3 ( ADS1256 only) 0100 = AIN4 ( ADS1256 only) 0101 = AIN5 ( ADS1256 only) 0110 = AIN6 ( ADS1256 only) 0111 = AIN7 ( ADS1256 only) 1xxx = AINCOM (when NSEL3 = 1, NSEL2, NSEL1, NSEL0 are ¡°don¡¯t care¡±) */ if (_ch > 7) { return; } ADS1256 _WriteReg(REG_MUX, (_ch = 400000) { printf(" ADS1256 _WaitDRDY() Time Out ...\r\n"); } } /* ********************************************************************************************************* * name: ADS1256 _ReadData * function: read ADC value * parameter: NULL * The return value: NULL ********************************************************************************************************* */ static int32_t ADS1256 _ReadData(void) { uint32_t read = 0; static uint8_t buf[3]; CS_0(); /* SPI cs = 0 */ ADS1256 _Send8Bit(CMD_RDATA); /* read ADC command */ ADS1256 _DelayDATA(); /*delay time */ /*Read the sample results 24bit*/ buf[0] = ADS1256 _Recive8Bit(); buf[1] = ADS1256 _Recive8Bit(); buf[2] = ADS1256 _Recive8Bit(); read = ((uint32_t)buf[0] 7) { return 0; } iTemp = g_tADS1256.AdcNow[_ch]; return iTemp; } /* ********************************************************************************************************* * name: ADS1256 _ISR * function: Collection procedures * parameter: NULL * The return value: NULL ********************************************************************************************************* */ void ADS1256 _ISR(void) { if (g_tADS1256.ScanMode == 0) /* 0 Single-ended input 8 channel£¬ 1 Differential input 4 channe */ { ADS1256 _SetChannal(g_tADS1256.Channel); /*Switch channel mode */ bsp_DelayUS(5); ADS1256 _WriteCmd(CMD_SYNC); bsp_DelayUS(5); ADS1256 _WriteCmd(CMD_WAKEUP); bsp_DelayUS(25); if (g_tADS1256.Channel == 0) { g_tADS1256.AdcNow[7] = ADS1256 _ReadData(); } else { g_tADS1256.AdcNow[g_tADS1256.Channel-1] = ADS1256 _ReadData(); } if (++g_tADS1256.Channel >= 8) { g_tADS1256.Channel = 0; } } else /*DiffChannal*/ { ADS1256 _SetDiffChannal(g_tADS1256.Channel); /* change DiffChannal */ bsp_DelayUS(5); ADS1256 _WriteCmd(CMD_SYNC); bsp_DelayUS(5); ADS1256 _WriteCmd(CMD_WAKEUP); bsp_DelayUS(25); if (g_tADS1256.Channel == 0) { g_tADS1256.AdcNow[3] = ADS1256 _ReadData(); } else { g_tADS1256.AdcNow[g_tADS1256.Channel-1] = ADS1256 _ReadData(); } if (++g_tADS1256.Channel >= 4) { g_tADS1256.Channel = 0; } } } /* ********************************************************************************************************* * name: ADS1256 _Scan * function: * parameter:NULL * The return value: 1 ********************************************************************************************************* */ uint8_t ADS1256 _Scan(void) { if (DRDY_IS_LOW()) { ADS1256 _ISR(); return 1; } return 0; } /* ********************************************************************************************************* * name: Write_ DAC8552 * function: DAC send data * parameter: channel : output channel number * data : output DAC value * The return value: NULL ********************************************************************************************************* */ void Write_ DAC8552 (uint8_t channel, uint16_t Data) { uint8_t i; CS_1() ; CS_0() ; bcm2835_spi_transfer(channel); bcm2835_spi_transfer((Data>>8)); bcm2835_spi_transfer((Data&0xff)); CS_1() ; } /* ********************************************************************************************************* * name: Voltage_Convert * function: Voltage value conversion function * parameter: Vref : The reference voltage 3.3V or 5V * voltage : output DAC value * The return value: NULL ********************************************************************************************************* */ uint16_t Voltage_Convert(float Vref, float voltage) { uint16_t _D_; _D_ = (uint16_t)(65536 * voltage / Vref); return _D_; } //New Code //Note that this was taken from the beginning of Main before the main while loop //Note print commands have been removed //Note we are able to declare the PyObject structure since we included Python.h //I gave this custom function the name py_myInitFunction, but you can make any //function you want with this format. There are no expected inputs to this function. /* * Init Function to be called from Python */ static PyObject* py_myInitFunction(PyObject* self, PyObject* args) { char *s = "Now Intializing!"; uint8_t id; bcm2835_init(); bcm2835_spi_begin(); bcm2835_spi_setBitOrder(BCM2835_SPI_BIT_ORDER_LSBFIRST ); // The default bcm2835_spi_setDataMode(BCM2835_SPI_MODE1); // The default bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_1024); // The default bcm2835_gpio_fsel(SPICS, BCM2835_GPIO_FSEL_OUTP);// bcm2835_gpio_write(SPICS, HIGH); bcm2835_gpio_fsel(DRDY, BCM2835_GPIO_FSEL_INPT); bcm2835_gpio_set_pud(DRDY, BCM2835_GPIO_PUD_UP); ADS1256 _CfgADC( ADS1256 _GAIN_1, ADS1256 _30000SPS); id = ADS1256 _ReadChipID(); //printf("\r\n"); //printf("ID=\r\n"); if (id != 3) { printf("Error, ASD1256 Chip ID = 0x%d\r\n", (int)id); } else { printf("Ok, ASD1256 Chip ID = 0x%d\r\n", (int)id); } //New Code //This command changes the basic rate of the device // ADS1256 _CfgADC( ADS1256 _GAIN_1, ADS1256 _30000SPS); ADS1256 _StartScan(0); return Py_BuildValue("s", s); } //New Code //Note that this function is similar to the initialization //but we now have inputs specified by PyArg_ParseTuple() /* * Main function to be called from Python */ static PyObject* py_myMainFunction(PyObject* self, PyObject* args) { int32_t adc[8]; int32_t volt[8]; uint8_t i; uint8_t jj; uint8_t ch_num; int32_t iTemp; uint8_t buf[3]; long int start_time; struct timespec gettime_now; double allchann[8]; double x1, x2, x3, x4, x5, x6, x7, x8; //PyArg_ParseTuple is a function from python.h. // the "dd" statement asks for two doubles. //There are many other data types. See docs.python.org/.../arg.html // ADS1256 _StartScan(0); PyArg_ParseTuple(args, "dd", &x1, &x2); ch_num = 4; //max channels //while(( ADS1256 _Scan() == 0)); // this is the default placement of this command // for (jj = 0; jj > 16) & 0xFF; buf[1] = ((uint32_t)adc[i] >> 8) & 0xFF; buf[2] = ((uint32_t)adc[i] >> 0) & 0xFF; //clock_gettime(CLOCK_REALTIME, &gettime_now); //printf("%8ld", (gettime_now.tv_nsec-start_time)/100000); //printf("%8ld%8ld%8ld%8ld",(int)i, (int)buf[0] , (int)buf[1] , (int)buf[2] ); iTemp = volt[i]; /* uV */ allchann[i]=(double)iTemp/1000000; //printf("%8ld", 0.001); if (iTemp < 0) { iTemp = -iTemp; //printf(" (-%ld.%03ld %03ld V) \r\n", iTemp /1000000, (iTemp%1000000)/1000, iTemp%1000); } else { //printf(" ( %ld.%03ld %03ld V) \r\n", iTemp /1000000, (iTemp%1000000)/1000, iTemp%1000); } } //start_time=gettime_now.tv_nsec; //bsp_DelayUS(100); //This delay might freeze the entire python for a while. //Note: Py_BuildValue allows you to build and return a value //return Py_BuildValue("dddddddd", allchann[0], allchann[1], allchann[2], allchann[3], allchann[4], allchann[5], allchann[6], allchann[7]); return Py_BuildValue("dddd", allchann[0], allchann[1], allchann[2], allchann[3] ); //return Py_BuildValue("dd", allchann[0], allchann[1] ); } /* * Closing function */ static PyObject* py_myClosingFunction(PyObject* self, PyObject* args) { double x, y; PyArg_ParseTuple(args, "dd", &x, &y); bcm2835_spi_end(); bcm2835_close(); return Py_BuildValue("d", 1.0); } /* * Bind Python function names to our C functions */ static PyMethodDef myModule_methods[] = { {"myInitFunction", py_myInitFunction, METH_VARARGS}, {"myMainFunction", py_myMainFunction, METH_VARARGS}, {"myClosingFunction", py_myClosingFunction, METH_VARARGS}, {NULL, NULL} }; /* * Python calls this to let us initialize our module */ void initmyModule() { (void) Py_InitModule("myModule", myModule_methods); } //End of C File

Forum Post: RE: DAC8552: DAC8552 gives only zero or full scale output

$
0
0
Howdy Simon, And welcome to the e2e forums! I'm not too familiar with the code presented above, but one better way to solve this issue is to provide an oscilloscope capture of the complete 24-bit SPI transaction. This will help determine if there are any irregularities, or timing constraints not meeting the specifications listed in the DAC8552 datasheet. Best Regards, Matt

Forum Post: ADC12J4000EVM: Help to parse ADC12J4000EVM data stream

$
0
0
Part Number: ADC12J4000EVM I am currently setting up to use: 3760MHz clk, decimation by 4; P54=1; Therefore the data stream is suppose to be a I/Q demodulated signal. However, I really only set up this way to simplify the FPGA code on the TSW14J56EVM side (using 4 lanes instead of 8). What would be the way for me to still get the actual time series data once I received the raw data in the FPGA in TSW14J56EVM ? Thanks for help! Regards, Bing

Forum Post: RE: TLV320AIC3120 EVM USB Audio driver problem

$
0
0
I am having a similar problem on my TLV320AIC3204 board. It used to work fine, and now AIC3254 CS software shows EVM disconnected. Is there a remedy to this? Thanks. Leo

Forum Post: RE: TLV320AIC3204EVM-K: Configuring the TLV320AIC3204EVM-K for digital mic input

$
0
0
Hi Luis, I tried reviving my board by following the "How to Revive a USB Audio EVM" procedure but the AIC3254 CS software shows EVM disconnected. Is there a remedy to this? Thanks. Leo

Forum Post: TVP5146M2 Presales Question

$
0
0
1: I have a project where I need to convert legacy video signals such as CVBS NTSC and PAL, Analog and Digital RGB, and VGA to HDMI. I believe the TVP5146M2 is the current part that would best fit my needs of getting the signals to digital. Can someone please confirm this? I do know the TVP5146M2 does not output to HDMI and I need another IC for that. 2: I then would like to ask about CVBS NTSC input, and Analog RGB input with a Horizontal Scan Frequency of 15.700 kHz, and VGA at 15 kHz. These are slightly lower than what is usually standard. Will there be any issues when using the TVP5146M2? Can I set the registers to sync and lock correctly to the non-standard frequency? Or does the IC lock automatically after some time? Or will there be need for some extra configuration or parts involved? 3: Lastly, I noticed the TVP5146EVM-TVP5146 Evaluation Module is out of stock. Is this the board I should use for testing or is there something that supersedes it? If I place an order then how long typically is delivery on out of stock items? Thanks in advance for your assistance,. and I look forward to a response. Henry

Forum Post: ADS8684: Having a High fail rate! Could use some advice...

$
0
0
Part Number: ADS8684 We are having issues with the ADS8684 A2D chip. Had a design built that was based off the Datasheet, including the decoupling capacitors. when we prototyped it up seemed to work fine moved on. When we sent boards out to a pick and place company we had an unusually high fail rate (6/8 failed) when I removed the chip and soldered in (by hand) I still ended up with (3/6 failed). After we got all boards working, they ran for a day and a half and then we had two chips fail. Now I understand it would seem that it is a design flaw in our boards, however this issue is very random and dosent keep happening to the same boards. Im wondering if this chip is sensitive in some way that we are unaware of... We thought it was the bake temp but it never reached a temp that was excessive. Thanks for any help!

Forum Post: RE: PCM5102A-Q1: PCM5102A-Q1 Power on sequence

$
0
0
Hi, Diego-san, Thank you for your reply. I understood about "case 1". However, I want you to continue to discuss about "case 2". For Case 2: I described about this case deeply as shown below. In this case, two Power components are used to supply voltage to PCM5102A-Q1 . So, there is possibility that one of these will not work correctly. In this conditon, we want to confirm whether PCM5102A-Q1 will be damaged or broken or not. From your previous comment, " As long as the Power On reset process is complete (both power supplies are stable and have a level above 2.8V), the device should not have any problems and will operate as expected" I understood since POR process is NOT complete(because there is possibility that one of these power supply will NOT ramp up),the device may have problems(such as be damaged or broken.). Is my understanding correct ? Best Begards, Machida

Forum Post: RE: DAC8750: Does Read Data from DAC Register are compensated while CAL Enabled?

$
0
0
Hi Kevin-san; Thank you for your confirmation and answer for Q2. Yes, your reply related to Q2 is right, that was what I am asking for. Thank you again. Macs

Forum Post: RE: ADS1298 with single lead ECG

$
0
0
Jaromir, It looks like R23 and R24 are connected to 3.3V. This will exceed the input voltage range for the PGA. Also, do you have ac coupling capacitors on a different schematic page or were they intentionally excluded? You are also going to want some kind of anti-aliasing on the inputs. I recommend a cutoff frequency of ~15 kHz. You should tie the START pin low if you intend to control the device with the START command. Tie the PWDN/RESET pin high for similar reasons. Tie CLKSEL high to use the internal clock. The DRDY pin needs to go to the host to indicate new data are ready. I also recommend tying the GPIO pins low if unused. Regards,

Forum Post: TLV320ADC3101: AMIC configuration / Setting for ADC - TLV320ADC3101

$
0
0
Part Number: TLV320ADC3101 Giving you the background and current status We are able to enumerate the ADCs. I2C accesses are fine. I2S accesses are fine. Issue – We are seeing the AMIC output moving but we are not able to properly get it through ADC. So I need your help to get to know the right setting that we need to have. What are the setting that we need to follow for this MIC? Now we have a maximum gain settings of 40db + 20db. Thanks, Supritha

Forum Post: RE: TLV320AIC3111 I2C address

$
0
0
Hi Luis, Now, we want to config the sample rate to 192kHz. We need some suggestion. Our host controller support 256fs only, so MCLK = 256 * 192k = 49.152MHz. How to config TLV320AIC3111 sample rate to 192kHz or others?
Viewing all 89308 articles
Browse latest View live


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