Part Number: MCU-PLUS-SDK-AM243X
Other Parts Discussed in Thread: LP-AM243
Dear TI
I have the PROFINET Device v2.00.01 "Compact IO-Device Example Project" running on an LP-AM243 (revision E2) using the AM243x MCU+ SDK 08.02.00. Without modifications this example project is running fine and I can communicate via with an AM64x Evaluation Module (using the PROFINET protocol).
I see that in the function APP_runProfinetStack() I can get the input and output buffer addresses via PN_API_DEV_getBufferInputData() and PN_API_DEV_getBufferOutputData(). But these buffers pBufOut and pBufIn seem to be unstructured.
So within I APP_runProfinetStack() tried using PN_API_DEV_getExpectedSubmodule() to get to the actual data in a submodule / subslot. Here's my full code of the full function APP_runProfinetStack():
uint32_t APP_runProfinetStack (
void)
{
uint32_t result = 0;
uint8_t *pBufOut = NULL;
uint8_t *pBufIn = NULL;
static uint8_t incrementValue = 0;
PN_API_DEV_EAr_t ar_p = PN_API_DEV_eAR_DA;
PN_API_DEV_SModule_t Module_p = {0};
PN_API_DEV_SSubmodule_t Submodule_p = {0};
uint16_t index_p = 0;
/*This function must be called regularly.*/
result = PN_API_PDEV_run ();
if (result != PN_API_PDEV_eOK)
{
goto laError;
}
result = PN_API_DEV_getBufferOutputData (&pBufOut);
if (result != PN_API_DEV_eOK)
{
goto laError;
}
result = PN_API_DEV_getBufferInputData (&pBufIn);
if (result != PN_API_DEV_eOK)
{
goto laError;
}
/*Input data is updated before being sent to controller.*/
//pBufIn[0] = pBufOut[0];
//pBufIn[1] = ++incrementValue;
/*******************************************************
* TEST CODE BEGIN
*******************************************************/
Module_p.slotNumber = 1;
Module_p.moduleIdNumber = 0x00000005;
Module_p.moduleState = 1;
Module_p.numberOfSubModules = 1;
Submodule_p.subSlot = 0;
Submodule_p.id = 0;
Submodule_p.state = 0;
index_p = 0;
ar_p = PN_API_DEV_eAR_DA;
result = PN_API_DEV_getExpectedSubmodule(ar_p, &Module_p, index_p, &Submodule_p);
/*******************************************************
* TEST CODE END
*******************************************************/
result = PN_API_DEV_releaseBufferInputData ();
if (result != PN_API_DEV_eOK)
{
goto laError;
}
return result;
laError:
OSAL_printf("\r[APP] ERROR: Error during PROFINET stack run. Error code: 0x%8.8x\n", result);
return result;
}
However the return value of PN_API_DEV_getExpectedSubmodule() on line 53 is always PN_API_DEV_eERROR_PARAMETER_OUT_OF_RANGE (HEX: 0x38030402, DEC: 939721730). What am I doing wrong?
Is ar_p = PN_API_DEV_eAR_DA; correct?
What should Module_p.moduleState = be?
Thank you and best regards
Thomas
