Hi, I am working on MC33771BSP AFE and I am able to read measurement registers properly but the time taken from sending start of conversion bit to read current measurement register is 7ms , but as per datasheet it will take only 0.86 ms to read all measurement registers. Please any one support as I need to reduce the time for reading the measurement registers.
Thanks.
Paneri Shah.
已解决! 转到解答。
Hi Paneri,
I am the developer of the SW driver you shared screenshots from. A few notes and recommendations follows:
1. Time values in the BCC datasheet do not count any SW overhead. They asume time for transmission of SOC command (at the physical layer = SPI) + conversion + reading the values back. No time for pre- (and post-) processing of data at MCU is counted.
2. I suppose you are using S32K144 MCU with some code based on the examples provided with the SW driver. Therefore, the time mentioned in the datasheet is extended by packing the SPI frames, calculating/checking CRC and finally by not negligible time overhead of used S32K144 SPI SDK in your case.
3. If you would like to decreace the time for measuring the current to the possible minimum, I would recommend:
Best regards,
Jan
Hi Paneri,
Are you polling the EOC_N bit or wait for the maximum conversion time (546us in 16-bit mode, with some margin typically 600us) before reading all the measured values?
Is your SPI communication running at 4Mbps? If yes, it should indeed take in total ~900us.
Best regards,
Tomas
Hi Tomas, I have changed frequency to 4Mhz and ensure it using Hantek(please check image).
But still the time is not reduced after increasing frequency also. I have attached the code snippet below. Please take a look and support for reducing time of reading measurement registers.
If I'm counting well:
When you would be reading only the current, you should save reading of 24 registers in terms of the t(CLST_SPI) datasheet value, i.e. 24 times 40-bit SPI frame @4MHz, i.e. more than 240us from the t(CLST_SPI) datasheet value.
Therefore, with a highly optimized SW, you could be theoretically able to read the current within 500 us with the BCC configured to 15-bit ADC (not 16-bit ADC)
Best regards,
Jan
Hi Paneri,
I am the developer of the SW driver you shared screenshots from. A few notes and recommendations follows:
1. Time values in the BCC datasheet do not count any SW overhead. They asume time for transmission of SOC command (at the physical layer = SPI) + conversion + reading the values back. No time for pre- (and post-) processing of data at MCU is counted.
2. I suppose you are using S32K144 MCU with some code based on the examples provided with the SW driver. Therefore, the time mentioned in the datasheet is extended by packing the SPI frames, calculating/checking CRC and finally by not negligible time overhead of used S32K144 SPI SDK in your case.
3. If you would like to decreace the time for measuring the current to the possible minimum, I would recommend:
Best regards,
Jan
Hi,
I am trying to optimize the BCC_S32k144_Monitoring_Diagnostics code by transmit and receive LPSPI data in polling method. I am able to write the data for the first time properly but while reading the data the RDF flag of status register is not getting set because of which I am not able to read any data and simply getting CRC error. I have attached the code snippets below. Please help to find where is the issue.
Hi paneri,
the issue of your code is that RDR and TDR are 32b FIFO registers (not 8bit!). I cannot test any code as have not the HW equipment at home, but my test implementation of BCC_MCU_TransferSpi was like:
/* Not sure about the byte order...!! */
LPSPI0->TDR = (transBuf[0] << 24U) | (transBuf[1] << 16U) | (transBuf[2] << 8U) | (transBuf[3]);
LPSPI0->TDR = (transBuf[4]);
/* Wait till transfer is done. (LPSPI0->FSR[TXCOUNT] is 0) */
/* Wait till 2 words are in RX FIFO (LPSPI0->FSR[RXCOUNT] is 2) */
/* Read that two 32b words from LPSPI0->RDR a parse individual bytes to recvBuf */
BR,
Jan