Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Not applicable
I want to try to use the Xmc4500 Automatioin Kit as a Modbus Master.

After implementing the Modbuss001.. App and Generating the Code, i search in the code Timeout's of Request and Response Frames... perhabs i overlook ?? in which generated file are the timouts ?

Best Thanks 🙂
10 Replies
Travis
Employee
Employee
First like received
kestudent wrote:
I want to try to use the Xmc4500 Automatioin Kit as a Modbus Master.

After implementing the Modbuss001.. App and Generating the Code, i search in the code Timeout's of Request and Response Frames... perhabs i overlook ?? in which generated file are the timouts ?

Best Thanks 🙂


So sorry as I don't get your questions.
0 Likes
Not applicable
pleace forgett the first Question :)) i have found the answer...

But i have an another Question ?
After using and generating MODBUS001.. app:

Dave generates a mbport.h file, in this file its exist a vMBPortTimersDelay() function... Where is this function implemented ?

I hope you understand my question 🙂
0 Likes
Travis
Employee
Employee
First like received
Yeah.. I understand your question as I cannot find the function too.:(
0 Likes
Travis
Employee
Employee
First like received
The below code will not be compiled by the compiler since the function is not available. And I think the reason that this function is empty is because it is to allow user to create it's own timer for time out purposes.


if( ( eMBCurrentMode == MB_ASCII ) && MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS )
{
vMBPortTimersDelay( MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS );
}

0 Likes
Travis
Employee
Employee
First like received
The timeout wait is also disabled. And the reason for the timeout is described by the comments below.


/*! \brief Timeout to wait in ASCII prior to enabling transmitter.
*
* If defined the function calls vMBPortSerialDelay with the argument
* MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS to allow for a delay before
* the serial transmitter is enabled. This is required because some
* targets are so fast that there is no time between receiving and
* transmitting the frame. If the master is to slow with enabling its
* receiver then he will not receive the response correctly.
*/
#ifndef MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS
#define MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS ( 0 )
#endif

0 Likes
Not applicable
Thanks for the Answers...

Now Modbus Master is ready ... But when i implement the GUI in combination with modbus, the gui dont function ... Could be the reason is in SPI - Master Appi ?

Thanks...
0 Likes
Not applicable
//main.c
eMBErrorCode eStatus;

DAVE_Init();

/* Initialize GUI Library */
GUI_Init();

/* Set background colour */
GUI_SetBkColor(GUI_BLUE);

/* Clear screen */
GUI_Clear();


/* Initialization of MODBUS in RTU mode if require ASCII then pass MB_ASCII in eMBInit*/
eStatus = eMBInit( MB_RTU, 0x01, 0x02, 38400, MB_PAR_NONE);



/*Enable the Modbus Protocol Stack.*/
eStatus = eMBEnable( );

/* Modbus polling loop waiting for an Event*/
while(1)
{

....
}

//portserial.c

BOOL
xMBPortSerialPutByte( CHAR ucByte )
{
UART001_WriteData(MODBUS001_UART_HANDLE,ucByte);
GUI_DispHex(ucByte,8);
GUI_DispNextLine();
return TRUE;
}


Pin Assignment
UART Transmitt P1.5 (Half Duplex)

SPI MRST 2.5 MTSR 3.13 CLK P3.0 ChipSelect P3.1
IO4 P5.11

When the Modbus Master sends a Request Frame, compiler jumps to xMBSerialGetByte and write Data to the UART look above, i get the frame on the GUI but when I measure the RS485(TX-/TX+) interface using an oscilloscope I get nothing.

I hope somebody can help me...
0 Likes
Not applicable
in the last sentence i mean xMBPortSerialPutByte not xMBSerialGetByte sryy
0 Likes
Travis
Employee
Employee
First like received
Hi kestudent,

Maybe you can try the example or training independently to ensure that your GUI is working good first.

http://www.infineonforums.com/threads/1967-XMC_HOT-XMC4500-How-to-do-a-basic-GUI-display

http://www.infineonforums.com/threads/2386-XMC4500-GUI-Example-Ping-Pong-Game
0 Likes
Not applicable
okey i will try thank you
0 Likes