Tool/software:
Hello Support team,
We are using AM273x to collect data from AD7389-4 ADC chipset via SPI. Now we find that the sampling rate of the input data is limited by the rate of CS of SPI from AM273x. As shown in the following screenshot, the SPI clock is 20MHz, 4-pin mode, with CS hold enabled, the CS signal period is 14.25 us, so we get the sampling rate 70.2 KHz
Is there any way to increase the CS rate? What's the limit of the CS rate?
My data collection source code is as attached. Could you please check it out if I did something wrong? Or did I make any extra delay between each SPI transaction?
void AD738x_dataConversion(void) { int16_t adcResults[NUM_CHANNELS]; int32_t transferOK; uint8_t txBuf[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint8_t rxBuf[8] = { 0 }; MIBSPI_Transaction spiTransaction; spiTransaction.count = 8; // 4 channels x 16 bits = 8 bytes spiTransaction.txBuf = (void *)txBuf; spiTransaction.rxBuf = (void *)rxBuf; spiTransaction.peripheralIndex = 0U; spiTransaction.arg = NULL; DebugP_log("Starting AD738x data conversion loop...\n"); for (int i = 0; i < NUM_SAMPLES; i++) { // data conversion, first read commands transferOK = MIBSPI_transfer(gMibspiHandle[MSS_SPIB_J16], &spiTransaction); if ((transferOK != SystemP_SUCCESS) || (spiTransaction.status != MIBSPI_TRANSFER_COMPLETED)) { DebugP_log("AD738x SPI data conversion first read failed!\r\n"); DebugP_assert(FALSE); return; } // Parse channels from received buffer adcResults[0] = ((int16_t)rxBuf[0] << 8) | rxBuf[1]; // Ch1 adcResults[1] = ((int16_t)rxBuf[2] << 8) | rxBuf[3]; // Ch2 adcResults[2] = ((int16_t)rxBuf[4] << 8) | rxBuf[5]; // Ch3 adcResults[3] = ((int16_t)rxBuf[6] << 8) | rxBuf[7]; // Ch4 // Store results in adcBuffer for (int ch = 0; ch < NUM_CHANNELS; ch++) { adcBufferRaw[i][ch] = adcResults[ch]; } } for (int i = 0; i < NUM_SAMPLES; i++) { DebugP_log("%4d\n", adcBufferRaw[i][0]); } DebugP_log("Finished data conversion loop, stored %d samples.\n", NUM_SAMPLES); }
Also for more information, I attached a Saleae capture file for your reference. (please rename it from xxx.txt to xxx.sal)
PK n�[ digital-0.bin�Y��U�'�m���h�D��]:��E��!E*�*,L�Lce�.b������V�W�m�,RYI��̜{g��}���˾s��7�|gΏ�w�������G/u]�u�u{]�u��2|���~��_�3<�ꯏ�.���{z�7���,Ãÿo����)}^�B����Z!|r���������{/�f�CA#�6Z�z�ZC�/߿U��� ��<