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.

RTOS: Ti-RTOS

Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hello everybody ,

 Actually  Im doing work with AM65xx processor IDK von Family Sitara and i m already finish with the setup and install SDK RTOS 5.01  now I have to start with diagnostic for MCSPI, I already used the rtos_template_app_am65xx_a53 as Project to create my program . I created  the test Program as a Task , and I called it in my main File , butt i got  errors (look pleas at the Picture Fehler),  I can’t fixed  it. Can anyone  pleas checkout my program and tell me how can I fixed  this errors.

Best regrades

 

Anas

/**

*

* \brief Template application tasks file:

* This template application exercises multiple tasks and

* peripherals. The different task functions are run under

* separate Tasks in TI BIOS.

* The appTasksCreate function creates the different tasks.

* More tasks can be added in this function as required.

*/

/* Standard header files */

#include <string.h>

 

/*

30.11.18

for Use Mailbox, neet to include this header file

#include <ti/sysbios/knl/Mailbox.h>*/

 

 

/* XDCtools Header files */

#include <xdc/std.h>

#include <xdc/cfg/global.h>

#include <xdc/runtime/System.h>

#include <xdc/runtime/Error.h>

/* Local template app header file */

#include "app.h"

#include "SPI_log.h"

/* SPI Header files */

#include <ti/drv/spi/soc/SPI_soc.h>

#include <ti/drv/spi/SPI.h>

#include <ti/drv/spi/MCSPI.h>

/* MACROS*/

/* Test channel # */

#define MCSPI_TEST_CHN 0

/* Maximum # of channels per SPI instance */

#define MCSPI_MAX_NUM_CHN 4

/**

* @brief Function spi_test_task : Execute read on SPI bus

*

* @param[in] arg0, arg1: Arguments ( Currently not used)

* @retval none

*/

void mcspi_test_task(UArg arg0, UArg arg1)

{

//has been Changed from (Anas Mekkaoui ID:A0238198)

SPI_HWAttrs spi_cfg;

// SPI_v1_HWAttrs spi_cfg;

uint32_t instance;

uint32_t txBuf,rxBuf,len;

uint32_t terminateXfer = 0;

MCSPI_Params spiParams;

MCSPI_Handle spi[MCSPI_MAX_NUM_CHN];

/* Transaction data */

SPI_Transaction* transaction;

bool transferOk;

bool testPassed = true;

 

/* Soc configuration structures indexing starts from 0. If the IP

* instances start with 1, to address proper Configuration

* structure index, McSPI Instance should be substracted with 1

*/

instance=BOARD_MCSPI_MASTER_INSTANCE;

/* Set the default SPI init configurations */

SPI_socSetInitCfg(instance, &spi_cfg);

appPrint("\n spi_test task started");

/* Default SPI configuration parameters */

/* Initialize SPI handle */

/* SPI params structure */

MCSPI_Params_init(&spiParams);

/* Init SPI driver */

SPI_init();

spiParams.transferMode=SPI_MODE_BLOCKING;

spiParams.transferCallbackFxn=NULL;

spi[MCSPI_TEST_CHN]= MCSPI_open(instance, MCSPI_TEST_CHN,&spiParams);

if (!spi[MCSPI_TEST_CHN])

{

testPassed = false;

goto err;

}

 

/*At this point, the SPI driver is ready to block-mode data transfer for a particular instance identified by Handle */

/* TODO: Add SPI functionality test here */

// while(1){

//

// }

/* Write Command */

txBuf=0xA5A5A5A5; /* Test data 32bit*/

len=sizeof(txBuf);

transaction->txBuf=(UInt8 *)&rxBuf; /* Buffer to be written */

transaction->rxBuf=(UInt8 *)&txBuf;/* Buffer holding the received data */

transaction->count=len;/* Transfer Length ,transCount: Number of frames for this transaction */

transaction->arg=(void *)&terminateXfer;

transferOk=MCSPI_transfer(spi[MCSPI_TEST_CHN], transaction);/* Perform SPI transfer */

if (!transferOk)

{

/* SPI transaction failed */

testPassed=false;

goto err;

}

SPI_log("\n Received Data : %x. \n", rxBuf);

if (txBuf != rxBuf)

{

testPassed=false;

MCSPI_close(spi[MCSPI_TEST_CHN]);

}

err:

if(true == testPassed)

{

SPI_log("\n All tests have passed. \n");

}

else

{

SPI_log("\n Some tests have failed. \n");

}

Task_sleep(10);

appPrint("\n spi_test task ended");

Task_exit();

}

  • Hi,

    If you want to test the MCSPI, there are existing test examples already. Why you want to add it into RTOS template app? Is that your goal to merge several tests together (e.g, GPIO, UART, MCSPI)?

    Regards, Eric
  • Anas,

    I think the error is because "transaction" is being declared as a pointer to a SPI_Transaction structure, and this pointer is not being initialized before it is being referenced.

    SPI_Transaction* transaction;

    I think if you change the code as below it should fix this build error:

    SPI_Transaction  transaction;
    ...
    transaction.txBuf=(UInt8 *)&rxBuf; /* Buffer to be written */
    transaction.rxBuf=(UInt8 *)&txBuf;/* Buffer holding the received data */
    transaction.count=len;/* Transfer Length ,transCount: Number of frames for this transaction */
    transaction.arg=(void *)&terminateXfer;
    transferOk=MCSPI_transfer(spi[MCSPI_TEST_CHN], &transaction);/* Perform SPI transfer */

    Regards,
    Scott

  • Anas,

    Is the issue still pending?

    Regards, Eric
  • hello Scott,
    thanks for the request , i have initialized transaction=0, and the isue has been resolved :).
  • Hi Eric,

    Thanks a lot for ur request , so my goal actully is to test the MCSPI and check what gonna be received . I was alredy trying to test same programs from PDK, butt i got errors , therefore i created a task into RTOs Template .The problem on code has been resolved .Now when I am loading my code on Cortex A53 , i don't get any error. But I am not getting any output . I get this message at console:

    (MCU_PULSAR_Cortex_R5_0: AutoRun: Target not run as the symbol "main" is not defined).

    Regards

    Anas
  • Hi,

    >>>>>>I was alredy trying to test same programs from PDK, butt i got errors , therefore i created a task into RTOs Template. ======> If you have test error for the PDK program (which is built by makefile). It is better raise the issue detailing how you build, HW setup and what error was seen then we can check how we tested it.

    Adding an example that didn't work into RTOS template app will create more trouble.

    Are you running on A53 or R5?

    >>>>>>"Now when I am loading my code on Cortex A53 , i don't get any error. But I am not getting any output . I get this message at console:

    (MCU_PULSAR_Cortex_R5_0: AutoRun: Target not run as the symbol "main" is not defined)."

    If you run on A53, it is a known issue for CCS project on A53 core, for some reason the CCS can't see any symbols of the program loaded and the issue was tracked in TI bug tracking system. But you can still just click "run" to run it. (If the original example didn't work, I don't expect CCS template app will work; If the original example worked, the CCS template app may work or may not work, depending if you integrated MCSPI into it properly or not. Given the symbols are gone in CCS, you can't set breakpoint to debug).

    I would suggest you open a new thread detailing how the MCSPI test program itself didn't work then we check there.

    Regards, Eric