Is it possible to manually copy data from flash into the ADC PING-PONG buffer?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Anand,
For applications, the ADC buffer is a read only region. The use-case where ADC buffer is written-to is Hardware-in-loop mode (DMM module chapter of the TRM), where input data can be sent over CSI and written to the ADC region. By default in the application, the ADC buffer region is read only.
Could I ask what is the purpose of writing data from flash into the ADC buffer? It might be easier to implement to write the data into a generic memory location, and use that, if the purpose is to replay recorded data from flash.
Regards,
Aayush
Hi Anand,
The flash is also memory mapped directly to EXT_FLASH region. Not sure if there would be timing concerns on your side, but that could be used as well.
If you give me a day or so, I can look up the set of configs needed to put the device in HIL mode, which will allow writing into the ADC buffer.
Regards,
Aayush
Thanks Aayush. My colleague says that on the EVM he was able to write into the ADCBUF at 0xA4000000 and then read the value at 0xA5000000 Is this something to do with the EVM? Or perhaps CCS? Is some kind of memory simulation/emulation going on there maybe?
I am not able to do this on our own board which is closely modeled on the EVM. I would really appreciate it if you could double confirm for me that its not possible to write manually into the ADC buffer like so:
uint8_t* adcBuf = (uint8_t*)0xA4000000;
*adcBuf = 0xABCD;
And also yes definitely please do help with the HIL mode set up, it would help us greatly
Hi Anand,
I did try to write manually using the lines of code you had given but in CCS usually writes to ADC buffers can be seen using memory browser. But if you want to confirm the data is written in that location you could read back the data in that location and check (when I check for your two lines of code it did not happen).
To configure the AWR2944 in HIL mode, I would request you to please do the following steps:
Let me know if you are able to properly able to write to ADCBuffer location with the above steps. Please let me know if you have further questions.
Thanks and Regards,
Akshay.
I tried using the TI API to do this - please see the code attached. It does the ADC PING-ONG initializations you are referring to in this code I have attached.
I was unable to write to the ADCBUF with this code. I have also attached a PNG file showing the reg values and you can see the DMMADCBUFWREN field set to 1. One related question I had is, when I read from 0xA5000000, should I see the DMMADCBUFPINPONSEL set to 1? I don't see that happening with my code. This call does not seem to be toggling the DMMADCBUFPINPONSEL bit
CSL_REG32_FINS_RAW(&rssCtrlRegs->ADCBUFCFG1,
CSL_RSS_CTRL_ADCBUFCFG1_ADCBUFCFG1_ADCBUFPIPOSEL_MASK,
CSL_RSS_CTRL_ADCBUFCFG1_ADCBUFCFG1_ADCBUFPIPOSEL_SHIFT,
CSL_RSS_CTRL_ADCBUFCFG1_ADCBUFCFG1_ADCBUFPIPOSEL_MAX); /* Select PONG to write and PING to READ */
void Test_Fls_to_ADC(void) { ADCBuf_Params params; ADCBuf_Handle handle; ADCBuf_Config *config; ADCBuf_Attrs *attrs; CSL_rss_ctrlRegs *rssCtrlRegs; params.source= ADCBUF_SOURCE_HIL; /* Setup the default ADCBUF Parameters */ ADCBuf_Params_init(¶ms); /* Open the first ADCBUF Instance */ handle = ADCBuf_open(0, ¶ms); /* This will set the DMMADCBUFWREN bit to 1 since params.source is set to ADCBUF_SOURCE_HIL*/ /* Get the Object from ADCBuf Handle */ config = (ADCBuf_Config *) handle; attrs = (ADCBuf_Attrs *) config->attrs; rssCtrlRegs = (CSL_rss_ctrlRegs *) attrs->baseAddr; if (handle == NULL) { while(1); } else { CSL_REG32_FINS_RAW(&rssCtrlRegs->ADCBUFCFG1, CSL_RSS_CTRL_ADCBUFCFG1_ADCBUFCFG1_ADCBUFPIPOSEL_MASK, CSL_RSS_CTRL_ADCBUFCFG1_ADCBUFCFG1_ADCBUFPIPOSEL_SHIFT, 0U); /* Select PING to write */ for(count=0;count<10;count++) { /* Write into 0xA4000000 */ *(ADCBufWrite+count) = count; } CSL_REG32_FINS_RAW(&rssCtrlRegs->ADCBUFCFG1, CSL_RSS_CTRL_ADCBUFCFG1_ADCBUFCFG1_ADCBUFPIPOSEL_MASK, CSL_RSS_CTRL_ADCBUFCFG1_ADCBUFCFG1_ADCBUFPIPOSEL_SHIFT, CSL_RSS_CTRL_ADCBUFCFG1_ADCBUFCFG1_ADCBUFPIPOSEL_MAX); /* Select PONG to write and PING to READ */ for(count=0;count<10;count++) { ADCReadArray[count] = *(ADCBufRead+count); /* Read from 0xA5000000 */ } } /************************************************************************** * Test: Graceful shutdown **************************************************************************/ ADCBuf_close(handle); }
Hi Anand,
Ideally to run ADCBuf in HIL mode (to do basic reads/writes), you will not need API's from adcbuf.c. However, you could use the code I have attached to get the writes and reads from ADCBuffer in HIL mode. Please do review the code I have attached and let me know if you still face issues to write and read from ADC buffer in HIL mode.
/** * @file ADCBuf_HIL.c * * @brief * This is the file which demonstrates write and read from ADC Buffer in HIL model * * \par * NOTE: * (C) Copyright 2020 - 2021 Texas Instruments, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <kernel/dpl/DebugP.h> #include <kernel/dpl/HwiP.h> #include <kernel/dpl/ClockP.h> #include <ti/common/syscommon.h> #include <drivers/edma.h> #include <drivers/cbuff.h> #include "../dssgenerated/ti_board_config.h" #include "../dssgenerated/ti_board_open_close.h" #include "../dssgenerated/ti_dpl_config.h" #include "../dssgenerated/ti_drivers_config.h" #include "../dssgenerated/ti_drivers_open_close.h" #include "../../common_includes.h" #include <string.h> int32_t dss_ADCBuf_HIL_TC(){ volatile uint32_t rd_data_HIL[10], addr, count, data_write[10]; volatile bool flag = true; CSL_rss_ctrlRegs *rssCtrl; rssCtrl = (CSL_rss_ctrlRegs *)CSL_RSS_CTRL_U_BASE; //Memory intialization of ADCBUF memories CSL_FINS(rssCtrl->RSS_ADCBUF_PING_MEMINIT, RSS_CTRL_RSS_ADCBUF_PING_MEMINIT_RSS_ADCBUF_PING_MEMINIT_START, 0x1); while(!(CSL_FEXT(rssCtrl->RSS_ADCBUF_PING_MEMINIT_DONE, RSS_CTRL_RSS_ADCBUF_PING_MEMINIT_DONE_RSS_ADCBUF_PING_MEMINIT_DONE_DONE))==0x1); CSL_FINS(rssCtrl->RSS_ADCBUF_PONG_MEMINIT, RSS_CTRL_RSS_ADCBUF_PONG_MEMINIT_RSS_ADCBUF_PONG_MEMINIT_START, 0x1); while(!(CSL_FEXT(rssCtrl->RSS_ADCBUF_PONG_MEMINIT_DONE, RSS_CTRL_RSS_ADCBUF_PONG_MEMINIT_DONE_RSS_ADCBUF_PONG_MEMINIT_DONE_DONE))==0x1); CSL_FINS(rssCtrl->DMMSWINT1, RSS_CTRL_DMMSWINT1_DMMSWINT1_DMMADCBUFWREN,0x1); //Write to the memory location for(count = 0; count<10; ++count) { addr = CSL_RSS_ADCBUF_WRITE_U_BASE+0x4*count; WR_MEM_32(addr, 0x12345678+count); data_write[count] = 0x12345678+count; } //Switch write to pong so as to read from ping CSL_FINS(rssCtrl->DMMSWINT1, RSS_CTRL_DMMSWINT1_DMMSWINT1_DMMADCBUFPINPONSEL,0x1); //Make a read from appropriate RAM location for(count = 0; count<10; ++count) { rd_data_HIL[count] = RD_MEM_32(CSL_RSS_ADCBUF_READ_U_BASE+0x4*count); } for(count = 0; count<10; ++count) { if(data_write[count]!=rd_data_HIL[count]) { flag = false; break; } } if(flag) { test_print("ADCBuf HIL mode read and write is correct and successful!!\n"); } else { test_print("ADCBuf HIL mode read and write is incorrect??\n"); } return 0; }
Also, please let me know if you have further questions.
Thanks and Regards,
Akshay.