recover data from external flash by modbus

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

cross mob
gachetp
Level 2
Level 2
10 replies posted 25 sign-ins 10 questions asked

Hello I'm using a XMC45 and an external flash  IS25LP128F. My XMC communicate with a PC by modbus.

I would like to recover data from the flash by it. 

to test the data transmission, I use strcpy(Holding_Register->strMsg, "OFF - ON"); 

 definition:

typedef struct
{

...

chr8_t strMsg;

chr8_t strMsgtest[10];

...

} Data_Modbus_Holding_Register;

 

Declaration :

Holding_Register = (Data_Modbus_Holding_Register*)&reg_holding_buffer;

 

This solution work correctly, I recover data. 

 

but when I use : strcpy(Holding_Register->strMsg, "OFF - ON");  OR Holding_Register->strMsg =  "OFF - ON" OR Holding_Register->strMsg[0] =  "OFF - ON" I don't arrived to recover data. Someone can help me ? 

 

Best regards, 

Pierre Gachet

 

0 Likes
1 Solution
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Pierre,

 strcpy(Holding_Register->strMsg, "OFF - ON"); Could result in overflow, that could be your actual issue.

 OR Holding_Register->strMsg =  "OFF - ON" and Holding_Register->strMsg[0] =  "OFF - ON" are not right way to access the structure variable. 

This could resolve your problem.

Best Regards,
Vasanth R S

View solution in original post

0 Likes
2 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Pierre,

I did not understand the difference between the working code and non-working code from the explanation. Could you please list them as working code and non-working code in separate section for better understanding?

Best Regards,
Vasanth

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Pierre,

 strcpy(Holding_Register->strMsg, "OFF - ON"); Could result in overflow, that could be your actual issue.

 OR Holding_Register->strMsg =  "OFF - ON" and Holding_Register->strMsg[0] =  "OFF - ON" are not right way to access the structure variable. 

This could resolve your problem.

Best Regards,
Vasanth R S

0 Likes