I want to flash the two leds on DSP side which running with dsplink on my EVM-L138. After I added the flow code:
I2C_init(I2C0, I2C_CLK_400K);
LED_init(); the ARM side which running linux will hang up and print the following messages.
tps6507x 1-0048: TSC mode read failed
pca953x 1-0020: failed reading register
pca953x 1-0020: failed reading register
tps6507x 1-0048: TSC mode read failed
tps6507x 1-0048: TSC mode read failed
tps6507x 1-0048: TSC mode read failed
tps6507x 1-0048: TSC mode read failed
tps6507x 1-0048: TSC mode read failed
pca953x 1-0021: failed reading register
pca953x 1-0021: failed reading register
pca953x 1-0021: failed reading register
pca953x 1-0021: failed reading register
pca953x 1-0021: failed reading register
tps6507x 1-0048: TSC mode read failed
pca953x 1-0021: failed reading register
pca953x 1-0021: failed reading register
pca953x 1-0021: failed reading register
pca953x 1-0021: failed reading register
tps6507x 1-0048: TSC mode read failed
I don't know what I shoud to do if I want to use uart, iic,gpio,spi on DSP side when I use dsplink . these ips will belong to which core,ARM or DSP? DSP_main
/** ============================================================================
* @file main.c
*
* @path
*
* @desc Main function that calls TSK helloDSP application
*
* @ver 1.10
* ============================================================================
* Copyright (c) Texas Instruments Incorporated 2002-2009
*
* Use of this software is controlled by the terms and conditions found in the
* license agreement under which this software has been supplied or provided.
* ============================================================================
*/
/* ----------------------------------- standard I/O */
#include <std.h>
#include <stdio.h>
#include <string.h>
#include <clk.h>
/* ----------------------------------- DSP/BIOS Headers */
#include "helloDSPcfg.h"
#include <sys.h>
#include <sem.h>
#include <msgq.h>
#include <pool.h>
/* ----------------------------------- DSP/BIOS LINK Headers */
#include <dsplink.h>
#include <failure.h>
/* ----------------------------------- Sample Headers */
#include <tskMessage.h>
/* ----------------------------------- BSL Headers */
#include <evmomapl138.h>
#include <evmomapl138_led.h>
#include <evmomapl138_i2c.h>
#ifdef __cplusplus
extern "C" {
#endif
/* FILEID is used by SET_FAILURE_REASON macro. */
#define FILEID FID_APP_C
/* Number of iterations message transfers to be done by the application. */
Uint16 numTransfers;
static Int hello_world();
static void USTIMER_delay(Uint32 usec) ;
/** ============================================================================
* @func atoi
*
* @desc Converts character string to integer value.
*
* ============================================================================
*/
extern int atoi(const char* str);
Void main(Int argc, Char* argv [])
{
/* Task handler for TSK_create */
TSK_Handle hTask;
int i = 5;
//EVMOMAPL138_init();
I2C_init(I2C0, I2C_CLK_400K);
LED_init();
/* Initialize DSP/BIOS LINK. */
DSPLINK_init();
while(i--)
{
LED_toggle(LED_1);
USTIMER_delay(2000);
}
// EVMOMAPL138_init();
// LED_init();
/* Creating task for TSKMESSAGE application */
hTask = TSK_create(hello_world, NULL, 0);
if (hTask == NULL)
{
SET_FAILURE_REASON(SYS_EALLOC);
LOG_printf(&trace, "Create hello_world: Failed.\n");
}
}
static Int hello_world(void)
{
Int status = SYS_OK;
MSGQ_Queue dsp_msgq;
MSGQ_Queue dsp_msgq2;
SEM_Obj notifySemObj;
SEM_Obj notifySemObj2;
MSGQ_Attrs msgqAttrs;
MSGQ_Attrs msgqAttrs2;
Char dspMsgQName[20];
Char dspMsgQName2[20];
MSGQ_Msg *msg;
Uint16 msg_id;
/* Set the semaphore to a known state. */
SEM_new(¬ifySemObj, 0);
SEM_new(¬ifySemObj2, 0);
/* Fill in the attributes for this message queue. */
msgqAttrs.notifyHandle = ¬ifySemObj;
msgqAttrs.pend = (MSGQ_Pend)SEM_pendBinary;
msgqAttrs.post = (MSGQ_Post)SEM_postBinary;
msgqAttrs.notifyHandle = ¬ifySemObj2;
msgqAttrs.pend = (MSGQ_Pend)SEM_pendBinary;
msgqAttrs.post = (MSGQ_Post)SEM_postBinary;
strcpy(dspMsgQName, "hello");
if(status == SYS_OK)
{
/* Creating message queue */
status = MSGQ_open(dspMsgQName, &dsp_msgq, &msgqAttrs);
if(status != SYS_OK) {
LOG_printf(&trace, "MSGQ_open() failed. Status = [0x%x]", (unsigned int)status);
} else {
LOG_printf(&trace, "MSGQ_open() successed. Status = [0x%x]", (unsigned int)status);
}
MSGQ_setErrorHandler(dsp_msgq, 0);
}
strcpy(dspMsgQName2, "dspmsg2");
if(status == SYS_OK)
{
/* Creating message queue */
status = MSGQ_open(dspMsgQName2, &dsp_msgq2, &msgqAttrs);
if(status != SYS_OK) {
LOG_printf(&trace, "MSGQ_open(2) failed. Status = [0x%x]", (unsigned int)status);
} else {
LOG_printf(&trace, "MSGQ_open(2) successed. Status = [0x%x]", (unsigned int)status);
}
MSGQ_setErrorHandler(dsp_msgq2, 0);
}
do {
/* Receive a message */
status = MSGQ_get(dsp_msgq, msg, SYS_FOREVER);
if(status == SYS_OK) {
/* Return the message ID */
msg_id = MSGQ_getMsgId(*msg);
LOG_printf(&trace, "msg_id(dsp) = %d", msg_id);
LED_toggle(LED_1);
//USTIMER_delay(200000);
}
} while(msg_id != 98);
status = MSGQ_free((MSGQ_Msg)msg);
status = MSGQ_close(dsp_msgq);
if(status != SYS_OK)
{
LOG_printf(&trace, "MSGQ_close() failed. Status = [0x%x]", (unsigned int)status);
}
else
{
LOG_printf(&trace, "MSGQ_close() successed. Status = [0x%x]", (unsigned int)status);
}
return status;
}
static void USTIMER_delay(Uint32 usec)
{
volatile Int32 i, start, time, current;
for(i=0; i<usec; i++) {
start = CLK_gethtime();
time = 0;
while(time < 350) {
current = CLK_gethtime();
time = current - start;
}
}
}
#if defined (__cplusplus)
}
#endif /* defined (__cplusplus) */ arm_main
/** ============================================================================
* @file main.c
*
* @path
*
* @desc Linux specific implementation of helloDSP sample application's driver.
*
* @ver 1.10
* ============================================================================
* Copyright (c) Texas Instruments Incorporated 2002-2009
*
* Use of this software is controlled by the terms and conditions found in the
* license agreement under which this software has been supplied or provided.
* ============================================================================
*/
/* ----------------------------------- OS Specific Headers */
#include <stdio.h>
#include <string.h>
#include <unistd.h>
/* ----------------------------------- DSP/BIOS Link */
#include <gpptypes.h>
#include <dsplink.h>
#include <errbase.h>
/* ----------------------------------- Application Header */
#include <system_os.h>
#include <helloDSP.h>
/* ----------------------------------- DSP/BIOS Link */
#include "proc.h"
#include "pool.h"
#include "msgq.h"
#if defined (__cplusplus)
extern "C" {
#endif /* defined (__cplusplus) */
#if defined (DA8XXGEM)
/* Addresses of the DSP executable: */
/* c_int00 (dspAddr), symbol DSPLINK_shmBaseAddres (shmAddr) and .args section (argsAddr) */
extern Uint32 helloDSP_dspAddr;
extern Uint32 helloDSP_shmAddr;
extern Uint32 helloDSP_argsAddr;
/* Extern declaration to the default DSP/BIOS LINK configuration structure. */
extern LINKCFG_Object LINKCFG_config;
#endif
#define POOL_ID 0
#define NUM_BUF_SIZES 4
#define APP_MSG_SIZE DSPLINK_ALIGN(sizeof(gpp_message), DSPLINK_BUF_ALIGN)
typedef struct gpp_message_tag {
MSGQ_MsgHeader msgHeader;
Uint16 cmd;
} gpp_message;
int main (int argc, char** argv)
{
DSP_STATUS status = DSP_SOK;
Int i;
Char8 *dspExecutable = NULL;
Uint8 PROCESSOR_ID = 0;
Uint32 numBufs[NUM_BUF_SIZES];
Uint32 size[NUM_BUF_SIZES];
Uint16 poolId;
SMAPOOL_Attrs poolAttrs;
Char8 dspMsgQName[20];
Char8 dspMsgQName2[20];
MSGQ_Queue dsp_msgq;
MSGQ_Queue dsp_msgq2;
MSGQ_LocateAttrs syncLocateAttrs;
STATIC ZCPYMQT_Attrs mqtAttrs;
gpp_message *msg;
Uint16 compteur = 1;
Char8 string[5];
dspExecutable = argv[1];
if(DSP_SUCCEEDED(status)) {
/*
* Create and initialize the proc object.
*/
status = PROC_setup(NULL);
if(DSP_FAILED(status)) {
printf("PROC_setup() failed. Status = [0x%x]\n", (unsigned int)status);
} else {
printf("PROC_setup() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
if(DSP_SUCCEEDED(status)) {
/*
* Attach the DSP with which the transfers have to be done.
*/
status = PROC_attach(PROCESSOR_ID, NULL);
if(DSP_FAILED(status)) {
printf("PROC_attach() failed. Status = [0x%x]\n", (unsigned int)status);
} else {
printf("PROC_attach() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
if (DSP_SUCCEEDED(status)) {
/*
* Open a specific pool referenced by the pool Id
*/
size[0] = APP_MSG_SIZE;
numBufs[0] = 1;
size[1] = ZCPYMQT_CTRLMSG_SIZE;
numBufs[1] = 1;
size[2] = DSPLINK_ALIGN(sizeof(MSGQ_AsyncLocateMsg), DSPLINK_BUF_ALIGN);
numBufs[2] = 1;
size[3] = DSPLINK_ALIGN(sizeof(MSGQ_AsyncErrorMsg), DSPLINK_BUF_ALIGN);
numBufs[3] = 1;
poolAttrs.bufSizes = (Uint32 *)&size;
poolAttrs.numBuffers = (Uint32 *)&numBufs;
poolAttrs.numBufPools = NUM_BUF_SIZES;
poolAttrs.exactMatchReq = FALSE;
/* Make the pool id from pool no and dsp processor id.
*/
poolId = POOL_makePoolId(PROCESSOR_ID, POOL_ID);
status = POOL_open(poolId, &poolAttrs);
if (DSP_FAILED(status)) {
printf("POOL_open() failed. Status = [0x%x]\n", (unsigned int)status);
} else {
printf("POOL_open() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
if(DSP_SUCCEEDED(status)) {
/*
* Load the executable on the DSP.
*/
status = PROC_load(PROCESSOR_ID, dspExecutable, 0, NULL);
if(DSP_FAILED(status)) {
printf("PROC_load() failed. Status = [0x%x]\n", (unsigned int)status);
} else {
printf("PROC_load() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
if (DSP_SUCCEEDED(status)) {
/*
* Start execution on DSP.
*/
status = PROC_start(PROCESSOR_ID);
if(DSP_FAILED(status)) {
printf("PROC_start() failed. Status = [0x%x]\n", (unsigned int)status) ;
} else {
printf("PROC_start() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
if(DSP_SUCCEEDED(status)) {
/*
* Open the remote transport.
*/
mqtAttrs.poolId = poolId;
status = MSGQ_transportOpen(PROCESSOR_ID, &mqtAttrs);
if(DSP_FAILED(status)) {
printf("MSGQ_transportOpen() failed. Status = [0x%x]\n", (unsigned int)status);
} else {
printf("MSGQ_transportOpen() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
if(DSP_SUCCEEDED(status)) {
/*
* Locate the DSP's message queue
*/
syncLocateAttrs.timeout = WAIT_FOREVER;
status = DSP_ENOTFOUND ;
strcpy(dspMsgQName, "hello");
while ((status == DSP_ENOTFOUND) || (status == DSP_ENOTREADY)) {
status = MSGQ_locate(dspMsgQName, &dsp_msgq, &syncLocateAttrs);
if((status == DSP_ENOTFOUND) || (status == DSP_ENOTREADY)) {
usleep(100000);
} else if (DSP_FAILED(status)) {
printf("MSGQ_locate() failed. Status = [0x%x]\n", (unsigned int)status);
} else {
printf("MSGQ_locate() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
}
if(DSP_SUCCEEDED(status)) {
syncLocateAttrs.timeout = WAIT_FOREVER;
status = DSP_ENOTFOUND ;
strcpy(dspMsgQName2, "dspmsg2");
while ((status == DSP_ENOTFOUND) || (status == DSP_ENOTREADY)) {
printf("MSGQ_locate dspmsg2.\n");
status = MSGQ_locate(dspMsgQName2, &dsp_msgq2, &syncLocateAttrs);
if((status == DSP_ENOTFOUND) || (status == DSP_ENOTREADY)) {
usleep(100000);
} else if (DSP_FAILED(status)) {
printf("MSGQ_locate() failed. Status = [0x%x]\n", (unsigned int)status);
} else {
printf("MSGQ_locate() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
}
if(DSP_SUCCEEDED(status)) {
/*
* Allocate a message.
*/
status = MSGQ_alloc(poolId, APP_MSG_SIZE, (MSGQ_Msg *)&msg);
if(DSP_FAILED(status)) {
printf("MSGQ_alloc() failed. Status = [0x%x]\n", (unsigned int)status);
} else {
printf("MSGQ_alloc() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
printf("\n");
do {
scanf("%s", string);
} while(strcmp(string, "go"));
printf("\n");
do {
if(DSP_SUCCEEDED(status)) {
for(i=0; i<compteur; i++) {
/*
* Set the message ID.
*/
MSGQ_setMsgId(msg, (compteur * 10) + i);
printf("MsgId(gpp) = %d\n", (unsigned int)MSGQ_getMsgId(msg));
/*
* Send the message.
*/
status = MSGQ_put(dsp_msgq, (MSGQ_Msg)msg);
}
compteur++;
if(DSP_FAILED(status)) {
printf("MSGQ_put() failed. Status = [0x%x]\n", (unsigned int)status);
} else {
printf("MSGQ_put() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
usleep(1000000);
} while(compteur < 10);
printf("\n");
do {
scanf("%s", string);
} while(strcmp(string, "exit"));
printf("\n");
if(DSP_SUCCEEDED(status)) {
/*
* Release the message queue.
*/
status = MSGQ_release(dsp_msgq);
if(DSP_FAILED(status)) {
printf("MSGQ_release() failed. Status = [0x%x]\n", (unsigned int)status) ;
} else {
printf("MSGQ_release() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
if(DSP_SUCCEEDED(status)) {
/*
* Finalise the transport.
*/
status = MSGQ_transportClose(PROCESSOR_ID);
if(DSP_FAILED(status)) {
printf("MSGQ_transportClose() failed. Status = [0x%x]\n", (unsigned int)status) ;
} else {
printf("MSGQ_transportClose() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
if(DSP_SUCCEEDED(status)) {
/*
* Stop execution on DSP.
*/
status = PROC_stop(PROCESSOR_ID);
if(DSP_FAILED(status)) {
printf("PROC_stop() failed. Status = [0x%x]\n", (unsigned int)status) ;
} else {
printf("PROC_stop() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
if(DSP_SUCCEEDED(status)) {
/*
* Close a specific pool.
*/
status = POOL_close(poolId);
if(DSP_FAILED(status)) {
printf("POOL_close() failed. Status = [0x%x]\n", (unsigned int)status) ;
} else {
printf("POOL_close() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
if(DSP_SUCCEEDED(status)) {
/*
* Detach the DSP with which the transfers have been done.
*/
status = PROC_detach(PROCESSOR_ID);
if(DSP_FAILED(status)) {
printf("PROC_detach() failed. Status = [0x%x]\n", (unsigned int)status);
} else {
printf("PROC_detach() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
if(DSP_SUCCEEDED(status)) {
/*
* Destroys the data structures for the proc object
*/
status = PROC_destroy();
if(DSP_FAILED(status)) {
printf("PROC_destroy() failed. Status = [0x%x]\n", (unsigned int)status);
} else {
printf("PROC_destroy() succeeded. Status = [0x%x]\n", (unsigned int)status);
}
}
return 0 ;
}
#if defined (__cplusplus)
}
#endif /* defined (__cplusplus) */