Check for another COM port provided by your DAP-link. Mbed OS debug console where are crash reports printed is on UART1 -current settings.
Can you share? For another one who will need to solve something similar.
- variable
c
should beint
instead ofchar
printf
is slow function and this use case is not optimal , you can lose chars eazyprintf
do not like unfinished strings - like here
You can try it without printf
void charReceive(void){
debug.putc(Uart.getc());
}
or
#include "mbed.h"
RawSerial Uart(USBTX,USBRX);
char buffer[20];
int counter = 0;
volatile bool flag = false;
void charReceive(void){
if(!flag){
int c;
do{
c = Uart.getc();
buffer[counter++] = c;
}while(c != '\n');
flag = true;
buffer[counter] = '\0';
counter = 0;
}
}
int main(){
printf("Test\n");
Uart.baud(9600);
Uart.attach(&charReceive);
while(1){
if(flag){
printf("Output: %s\n", buffer);
flag = false;
}
}
}
BR, Jan