You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "acassis (via GitHub)" <gi...@apache.org> on 2024/02/06 19:28:50 UTC
[I] Modbus Master example was broken by PR #6038 [nuttx]
acassis opened a new issue, #11666:
URL: https://github.com/apache/nuttx/issues/11666
While helping @JorgeGzm to get Modbus Master working on his board we discovered that the mailing example was not working. Then I did some tests with different release versions and discovered it was broken between 10.3 and 11.0!
Then we did a git bisect and discovered that this PR https://github.com/apache/nuttx/pull/6038 was responsible for generating the issue.
Jorge discovered that adding a usleep() before acquiring the semaphore on FreeModbus helped to fix the issue, but we still investigation why that commit cause this issue. Hi @anjiahao1 could you please take a look? Maybe you can have some idea why this issue is happening. If you want to test the Modbus Example, I have a tutorial here: https://www.youtube.com/watch?v=FmJLrG4Ldow
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Modbus Master example was broken by PR #6038 [nuttx]
Posted by "JorgeGzm (via GitHub)" <gi...@apache.org>.
JorgeGzm commented on issue #11666:
URL: https://github.com/apache/nuttx/issues/11666#issuecomment-1931107853
Hi,
Testing the modbus master example: nuttx-apps/examples/modbusmaster/mbmaster_main.c
Whe check, if we add a delay before call the function eMBMasterReqReadHoldingRegister the problem stop and the the aplication back to work.
```c
printf("Sending %d requests to slave %d\n",
MBMASTER_REQUESTS_COUNT, SLAVE_ID);
usleep(1000); // Delay ADD
/* modbus is initialized and polling thread is running */
while (reqcounter < MBMASTER_REQUESTS_COUNT)
{
g_mbmaster.statistics.reqcount++;
mberr = eMBMasterReqReadHoldingRegister(SLAVE_ID,
SLAVE_STATUS_REG, 1, 1000);
if (mberr != MB_MRE_NO_ERR)
{
fprintf(stderr, "mbmaster_main: "
"ERROR: holding reg %d read failed: %d\n",
SLAVE_STATUS_REG, mberr);
g_mbmaster.statistics.errcount++;
}
reqcounter++;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Modbus Master example was broken by PR #6038 [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on issue #11666:
URL: https://github.com/apache/nuttx/issues/11666#issuecomment-1931236273
look like eMBMasterPoll can't be called before eMBMasterReqReadHoldingRegister? https://github.com/apache/nuttx/pull/6038 optimize the speed of thread creation, the new thread may run before pthread_create return.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org