Skip to content

Conversation

@pablogs9
Copy link
Member

@pablogs9 pablogs9 commented Jun 4, 2020

This PR adds service example and updates the UART serial transport to an IRQ approach


RCSOFTCHECK(rcl_send_response(&serv,&req_id,&res))
}
k_sleep(100);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was it removed?

Copy link
Member Author

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)) {
Copy link

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?

Copy link
Member Author

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.

Copy link

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?

Copy link
Member Author

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++;
Copy link

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?

Copy link
Member Author

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.

Copy link

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pablogs9 pablogs9 requested a review from julionce June 8, 2020 05:55

static void uart_fifo_callback(struct device *dev){
while (uart_irq_update(dev) && uart_irq_is_pending(dev)) {
if (uart_irq_rx_ready(dev)) {
Copy link

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++;
Copy link

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);
Copy link

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@pablogs9 pablogs9 requested a review from julionce June 8, 2020 06:59
@pablogs9 pablogs9 merged commit 727a88c into dashing Jun 11, 2020
@pablogs9 pablogs9 deleted the feature/add_service_example branch June 11, 2020 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants