Skip to content

USBSerial not working in for FRDM-K22f, MBED 5.13 #11044

@rkreifeldt

Description

@rkreifeldt

Description

I'm trying to use USBSerial on the FRDM-K22F with latest MBED 5.13.
I'm exporting to MCUXpresso.

It is first throwing an error because it is calling USBPhy *get_usb_phy() over in mbed_usb_phy. This is due to the face that DEVICE_USBDEVICE is not defined, so it is calling this function rather than the one over in USBPhy_Kinetis.cpp

I noticed is DEVICE_USBDEVICE is not in my Makefile C_FLAGS
Going back to the targets.json I notice that "USBDEVICE" is not in the "device_has" for the MCU_K22F512.

I added DEVICE_USBDEVICE to the Makefile C_Flags. This got it to compile.

My code is this:
#include "mbed.h"
#include "USBSerial.h"

DigitalOut myled(LED2);
USBSerial serial(false, 0x1f00, 0x2012,0x0001);

int main() {
while(1) {
myled = 1;
wait(0.5);
myled = 0;
wait(0.5);
printf("std:Hello World\n");
serial.printf("USB:Hello World\n");
}
}

Doing a look on my mac with ls /dev/tty.usb* I see the USB for the debug connection and if I attach using screen then I see my expected output.

The USBSerial however does not get recognized by the system.

I had it working on this board with MBED2 (API was different on USBSerial constructor), but I really want to go forward with MBED5

Issue request type

[ ] Question
[ ] Enhancement
[x ] Bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions