OpenCores

I2C Multiple Bus Controller

Issue List
Iicmb will keep busy when slave do not give a ack. #2
Closed wodish opened this issue over 8 years ago
wodish commented over 8 years ago

Iicmb will keep busy when slave do not give a ack.And I have to give a stop cmd to make iicmb module not busy.Is this a bug?

sshuv2 commented over 8 years ago

I think this is not a bug. When you receive 'No Ack' response you don't have to free the bus immediately (in contrast to 'Arbitration Lost' response). You might decide to continue working with the bus and, for example, try other slave addresses after repeated start. So, in this situation this is the upper layer's decision to free the bus or not.

In the software example file (software/iicmb.c) you can find the code which gives explicit 'Stop' command when the slave is not responding. It looks like:

<p class="cmd"> /* Start condition */ ret = iicmb_cmd_start(); if (ret != rsp_done) return ret; // Arb Lost

do { / Write slave address and write bit / ret = iicmb_cmd_write((sa << 1) | 0x00u); if (ret != rsp_done) break; // No Ack ... } while (0);

/ Stop condition / (void)iicmb_cmd_stop();

return ret;

</p>
sshuv2 commented over 8 years ago

Sorry, bad formatting. Another attempt :)

<p class="cmd"> /* Start condition */<br /> ret = iicmb_cmd_start();<br /> if (ret != rsp_done) return ret; // Arb Lost<br /> <br /> do {<br /> /* Write slave address and write bit */<br /> ret = iicmb_cmd_write((sa << 1) | 0x00u);<br /> if (ret != rsp_done) break; // No Ack<br /> ...<br /> } while (0);<br /> <br /> /* Stop condition */<br /> (void)iicmb_cmd_stop();<br /> <br /> return ret;<br /> </p>
sshuv2 commented over 8 years ago

And now formatting should be OK :)

<p class="cmd"> /* Start condition */<br /> ret = iicmb_cmd_start();<br /> if (ret != rsp_done) return ret; // Arb Lost<br /> <br /> do {<br /> /* Write slave address and write bit */<br /> ret = iicmb_cmd_write((sa &lt;&lt; 1) | 0x00u);<br /> if (ret != rsp_done) break; // No Ack<br /> ...<br /> } while (0);<br /> <br /> /* Stop condition */<br /> (void)iicmb_cmd_stop();<br /> <br /> return ret;<br /> </p>
sshuv2 closed this over 8 years ago
wodish commented over 8 years ago

Yes,you are right I thingk.Thx.:-)

wodish commented over 8 years ago

Yes,you are right I thingk.Thx.:-)


Assignee
No one
Labels
Bug