-
Notifications
You must be signed in to change notification settings - Fork 17
Update transport from poll to IRQ #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| RCSOFTCHECK(rcl_send_response(&serv,&req_id,&res)) | ||
| } | ||
| k_sleep(100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was it removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error, fixed
|
|
||
| static void uart_fifo_callback(struct device *dev){ | ||
| while (uart_irq_update(dev) && uart_irq_is_pending(dev)) { | ||
| if (uart_irq_rx_ready(dev)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when uart_irq_rx_ready return false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means the IRQ callback has been called for other reason different from rx ready event. This should not happen since only uart_irq_rx_enable(platform->uart_dev); has been enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, in case it happens what should we do? Should we break or return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| } | ||
| while(ring_buf_is_empty(&in_ringbuf) && spent_time < timeout){ | ||
| k_sleep(K_MSEC(1)); | ||
| spent_time++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it deterministic? I mean, is Zephyr able to ensure that when a task sleeps it won't be longer than the request time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When dealing with preemptive tasks and no higher priority task exists it is deterministic.
If there is a higher prio task, it may take longer. By default micro-ROS works on the preemptive task priorities ranges, so cooperative behavior is not contemplated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, is there a way to measure time in a deterministic manner?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| static void uart_fifo_callback(struct device *dev){ | ||
| while (uart_irq_update(dev) && uart_irq_is_pending(dev)) { | ||
| if (uart_irq_rx_ready(dev)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, in case it happens what should we do? Should we break or return?
| } | ||
| while(ring_buf_is_empty(&in_ringbuf) && spent_time < timeout){ | ||
| k_sleep(K_MSEC(1)); | ||
| spent_time++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, is there a way to measure time in a deterministic manner?
| return index; | ||
|
|
||
| uart_irq_rx_disable(platform->uart_dev); | ||
| read = ring_buf_get(&in_ringbuf, buf, len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be careful, read is a posix function and I don't know if it exis in Zephyr but could be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
This PR adds service example and updates the UART serial transport to an IRQ approach