retarget_io no works, no output on a terminal

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
HeDi_4635501
Level 3
Level 3
First solution authored 10 questions asked 25 sign-ins

Hello,

the retarget_io redirection suddenly no longer works on my laptop. I have a simple program LED blinking with text output. The flashing of the leds works, but the texts are not displayed on the terminal. I've compared many settings, but I can't find the problem.

Can someone help

Board: CY8CKIT-062-WiFi-BT

ModusToolbox 2.4

....

[ 76%] [######################## ] [ Programming ]
[ 81%] [######################### ] [ Programming ]
[ 88%] [############################ ] [ Programming ]
[ 97%] [############################### ] [ Programming ]
[100%] [################################] [ Programming ]
wrote 45568 bytes from file D:/ModusToolbox/Workspace/Blinking_LED/build/CY8CKIT-062-WIFI-BT/Debug/mtb-example-psoc6-empty-app.hex in 1.614849s (27.557 KiB/s)
** Programming Finished **
** Program operation completed successfully **
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
Info : SWD DPIDR 0x6ba02477
shutdown command invoked
Info : psoc6.dap: powering down debug domain...

0 Likes
1 Solution

Hi @HeDi_4635501 :

About your application, you also can learn about RTOS Stream & Message Buffers. You can find the difference from the link.

At first, you should create buffer call API xStreamBufferCreate() or xMessageBufferCreate().

Secondly, call API xStreamBufferSendFromISR() and xMessageBufferSendFromISR()  in ISR to send the data into the buffer.

At last, target task can receive the data from buffer call API xStreamBufferReceive() and xMessageBufferReceive().

Best Regards,

Colin

View solution in original post

0 Likes
4 Replies
HeDi_4635501
Level 3
Level 3
First solution authored 10 questions asked 25 sign-ins

Hi,

I did not understand the situation that no more outputs are possible on the appointment (cy_retarget_io_init). Windows updated yesterday and the output is back today. I don't know why, but this way I can continue working again.

Does anyone have experience with RTOS?

I would like a task for inputs and this data should then be output in another task.

Doesn't work the way I want yet. I'm always open to hints.

Regards

0 Likes
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi @HeDi_4635501 :

For Question 1,  could you show more information about the code or your operation flow? I think Widows Update is not the reason caused this question. 

For Question 2 of RTOS, if you want to input the data from a task, and get the data in another task, I suggest you to learn about the Queues. Detail description and API of Queues, you can find it from the link.

Best Regards,

Colin

 

0 Likes

Thanks for your answer,

I don't have any more info because it's running now. I'm testing and it's ok! What that was, I don't know.

Also my second question works now.

Data exchange via queues is clear, but the keyboard query via interrupt and the assignment of the channels to the task was not clear to me.

in the main() function

...

cyhal_uart_register_callback(&cy_retarget_io_uart_obj, rx_cback, NULL);
cyhal_uart_enable_event(&cy_retarget_io_uart_obj, CYHAL_UART_IRQ_RX_NOT_EMPTY , INPUT_TASK_PRIORITY, pdTRUE);
if (pdPASS != xTaskCreate(task_INPUT, "INPUT Task", INPUT_TASK_STACK_SIZE,
NULL, INPUT_TASK_PRIORITY, &input_task_handle))

...

and the input handler

void rx_cback(void *handler_arg, cyhal_uart_event_t event)
{
(void) handler_arg;
uint8_t readbyte;
cy_rslt_t status;
BaseType_t xYieldRequired = pdFALSE;

/* Read one byte from the buffer with a 1ms timeout */
status = cyhal_uart_getc(&cy_retarget_io_uart_obj , &readbyte, 1);

/* If a character was received, send it to the UART task */
if(CY_RSLT_SUCCESS == status)
{
xQueueSendFromISR( input_cmdQ, &readbyte, &xYieldRequired);
}

/* Yield current task if a higher priority task is now unblocked */
portYIELD_FROM_ISR(xYieldRequired);
}

Greetings to all

My big project is reading data from a second controller via Bluetooth and displaying the values!

 

0 Likes

Hi @HeDi_4635501 :

About your application, you also can learn about RTOS Stream & Message Buffers. You can find the difference from the link.

At first, you should create buffer call API xStreamBufferCreate() or xMessageBufferCreate().

Secondly, call API xStreamBufferSendFromISR() and xMessageBufferSendFromISR()  in ISR to send the data into the buffer.

At last, target task can receive the data from buffer call API xStreamBufferReceive() and xMessageBufferReceive().

Best Regards,

Colin

0 Likes