pavel_47
(Pavel Yermolenko)
March 16, 2020, 9:59pm
1
Hello,
Here is how terminal output looks:
terminal output
Here is function whre output to terminal occurs:
void displayThread()
{
char buffer[128];
printf("\033[2J\033[H"); // Clear Screen and go Home
printf("\033[?25l"); // Turn the cursor off
fflush(stdout);
while(1)
{
osEvent evt = queue.get();
if (evt.status == osEventMessage) {
msg_t *message = (msg_t*)evt.value.p;
switch(message->cmd)
{
case CMD_temperature:
sprintf(buffer,"Temperature = %2.1fF",message->value);
displayAtXY(1, 1, buffer);
break;
case CMD_setPoint:
sprintf(buffer,"Set Point = %2.1fF",message->value);
displayAtXY(1, 2, buffer);
break;
case CMD_time:
time_t rawtime;
struct tm * timeinfo;
time (&rawtime);
rawtime = rawtime - (5*60*60); // UTC - 4hours ... serious hack which only works in winter
timeinfo = localtime (&rawtime);
strftime (buffer,sizeof(buffer),"%r",timeinfo);
displayAtXY(1,3, buffer);
break;
case CMD_mode:
if(message->value == 0.0)
sprintf(buffer,"Mode = Off ");
else if (message->value < 0.0)
sprintf(buffer,"Mode = Heat");
else
sprintf(buffer,"Mode = Cool");
displayAtXY(1, 4, buffer);
break;
}
mpool.free(message);
}
}
}
Any comments ?
Thanks.
pavel_47
(Pavel Yermolenko)
March 17, 2020, 9:27am
2
I tried today. Today, I don’t see anything at all in Serial Monitor.
In the meantime I proceeded to upgrade to the version 0.9.
This is probably a bug in version 0.9.
pavel_47
(Pavel Yermolenko)
March 17, 2020, 9:48am
3
Here is the simplest code:
int main()
{
printf(“Started System\n”);
}
Nothing at all in Serial Monitor
ChrisTH
(Chris Hoffmann)
March 17, 2020, 10:54pm
4
Did you try a baud rate of 9600 in the terminal? I believe that is the default…
Otherwise, what is the declaration & initialisation of your serial port?
pavel_47
(Pavel Yermolenko)
March 17, 2020, 11:30pm
5
Yes, I’ve tried all rates.
Moreover, I’ve also tried with .json file:
{
“target_overrides”: {
“*”: {
“platform.stdio-baud-rate”: 115200
}
}
}
*
Otherwise, what is the declaration & initialisation of your serial port?
There is no declaration/initialization. The link on the project that apparently works on MacOS is here:
https://iotexpert.com/2019/12/09/mouser-psoc-6-wifi-bt-mbed-l3-display-thread/
ChrisTH
(Chris Hoffmann)
March 18, 2020, 3:38am
6
I’m using MBed Studio 0.9 and it doesn’t have any problems writing to the serial port (both USB and traditional UART).
OTOH, I always explicitly declare a serial port along the lines of:
The APIs of Mbed OS: platform, drivers, RTOS, connectivity, security and storage
pavel_47
(Pavel Yermolenko)
March 18, 2020, 8:52am
7
I don’t know what the problem was, but today it works. Probably some problem with Windows preventing the COM port from communicating.
arekzaluski
(Arkadiusz Zaluski)
March 18, 2020, 6:32pm
8
Hi Pavel,
I’m glad that it works for you. The two most common causes of this issue are:
Having a serial monitor open outside of Mbed Studio. Only one serial monitor can have access to the board at the same time.
There is a regression in Mbed Studio 0.9.0. Serial panel is not reopening correctly for a board when it was closed manually using a close (x button). We are working on a fix. It will be fixed in upcoming release. Until then restarting Mbed Studio is the only way to fix it. Disconnecting and reconnecting a board is not triggering this issue. Only manual close.
Thanks,
Arek - Mbed Studio team