RMT transmission synchronization to input pin state

Captain.Chode
Posts: 15
Joined: Mon Mar 11, 2019 4:23 pm

RMT transmission synchronization to input pin state

Postby Captain.Chode » Thu Jan 04, 2024 9:10 am

I have a 125 kbit/sec multi-master bus. It takes 8 microseconds to transfer 1 bit. The initial state of the bus is high. In order to transmit a message we need to listen on the bus and if there were no low state on the bus for 16*8 microseconds then we can start transmitting. This might be solved by installing an interrupt on my RX pin and start a timer. But the problem is that I need to stop the transmission immediately when I detect a mismatch on the state of the TX and RX pins (basically when I receive a 0 but I just sent 1). Because that means that another peripheral is started sending in the meanwhile (0 is a dominant state over 1). How is it possible with the RMT peripheral?

Captain.Chode
Posts: 15
Joined: Mon Mar 11, 2019 4:23 pm

Re: RMT transmission synchronization to input pin state

Postby Captain.Chode » Thu Jan 04, 2024 5:24 pm

EDIT: the following text was a reply for an answer which has been deleted. The user was registered after I opened my topic, and the answer was very ChatGPT-like (it cited the api reference in a slightly modified way)

Can you show me an example how to set up detecting a mismatch?

The api reference is talking about loop count, but nothing about a condition on when to stop the transmit: https://docs.espressif.com/projects/esp ... ransaction

The technical reference manual states this on page 402:
The data structure in RAM is shown in Figure 15-2. Each 32-bit value contains two 16-bit entries, with two fields
in every entry, ”level” and ”period”. ”Level” indicates whether a high-/low-level value was received or is going to be
sent, while ”period” points out the divider-clock cycles for which the level lasts. A zero period is interpreted as an
end-marker: the transmitter will stop transmitting once it has read this, and the receiver will write this, once it has
detected that the signal it received has gone idle.
So it says that it stops transmitting when the period is set to 0. Again, nothing about conditional stop.

As I said I would like to stop is the transmit part not the receive part (what you seem to referring to)

I am afraid it can't be done because as I understand I send data to the RMT like this:
the line is 0 for 8us,
the line is 1 for 24us,
the line is 0 for 8us,
the line is 1 for 8us.

And I might want to stop the transmission in the middle of the data.

See the picture below: We want to transmit -8, 24, -8, 8 but on the input pin we need to detect at 8+16us (basically at the 3rd bit - remember I said one bit is 8us long) that the line went low in the meanwhile (someone else also started transmitting) so we drop the rest of the data to be transmitted (stop immediately)
collision.jpg
collision.jpg (20.79 KiB) Viewed 5488 times

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: RMT transmission synchronization to input pin state

Postby ESP_Sprite » Fri Jan 05, 2024 9:34 am

Captain.Chode wrote:
Thu Jan 04, 2024 5:24 pm
EDIT: the following text was a reply for an answer which has been deleted. The user was registered after I opened my topic, and the answer was very ChatGPT-like (it cited the api reference in a slightly modified way)
Yep, user was a spammer; they later edited a spam-link into the post.

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: RMT transmission synchronization to input pin state

Postby MicroController » Fri Jan 05, 2024 12:28 pm

Maybe check if the "collision detection" feature of the UART in RS485 mode would work for your case.

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 346 guests