Part Number: 66AK2H14
Other Parts Discussed in Thread: SYSBIOS
Hello, I'm looking for some example code to use the SPI interface. Where is the best place to look?
I'm also looking for a delay routine that uses a timer.
Thank you,
Joe
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,
There is SPI flash connected to TI K2H EVM. You can download the Processor SDK RTOS for 66AK2H14 device http://software-dl.ti.com/processor-sdk-rtos/esd/K2HK/latest/index_FDS.html and following the
| K2H/K2K RTOS SDK Documentation | |||
| Processor SDK RTOS Release Notes | Link to Release Notes for Processor SDK RTOS | ||
| Processor SDK RTOS Getting Started Guide | Link to Getting Started Guide for Processor SDK RTOS | ||
| Processor SDK RTOS Developer Guide | Link to Developer Guide for Processor SDK RTOS | ||
There are SPI examples under pdk_k2hk_4_0_xx\packages\ti\drv\spi. Also user guide: http://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_device_drv.html#mcspi-qspi-ospi
For the delay routine, a simple one is the cycleDelay() in pdk_k2hk_4_0_xx\packages\ti\drv\pcie\example\sample\src\pcie_sample.c
/*****************************************************************************
* Function: Utility function a cycle clock
****************************************************************************/
static uint32_t readTime32(void)
{
uint32_t timeVal;
#if defined (_TMS320C6X)
timeVal = TSCL;
#elif __ARM_ARCH_7A__
__asm__ __volatile__ ("MRC p15, 0, %0, c9, c13, 0\t\n": "=r"(timeVal));
#else
/* M4 specific implementation*/
static uint32_t simuTimer = 0;
simuTimer++;
timeVal = simuTimer;
#endif
return timeVal;
}
/*****************************************************************************
* Function: Utility function to introduce delay
****************************************************************************/
void cycleDelay (uint32_t count)
{
uint32_t start = (uint32_t)readTime32();
while (((uint32_t)readTime32() - start) < count);
}
Regards, Eric
Eric,
Hello and thank you very much for the delay function. I will get the PDK install soon.
Thank you,
Joe
Eric,
HI, I keep getting an error pertaining to uint32_t data type. What header file do I need to include?
Eric,
Hi, when I run the code the function readTime32() always returns 0. I have a very simple code, would you mind giving it a quick look over. I'm running the code on an ARM core.
Here is the gel I'm using:
Thank you very much,
Joe
Hi,
Your case is a bare metal one, I am not sure if you missed some setup, like the I-cache, D-cache and MMU. The code I provided was tested in a SYSBIOS environment. Are you able to use that environment?
Regards, Eric
HI Eric,
That is probably my problem. I'm doing Bare metal and I'm probably has you said missing some setup stuff. Thank you very much for helping me and not kicking me to the street. I really appreciate you helping a "newbie" like myself.
Respectfully,
Joe