Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 1 month ago.
CAN library and USBHost issue
Hi all,
I experienced some weird issue when trying to use the mbed CAN port and the mbed USB port (pins p31 and p32) in the same program.
Here are the steps I tried:
1) Version 1: CAN alone ==> OK I started to work mbed CAN port and tested the mbed CAN example: https://developer.mbed.org/handbook/CAN
I could send and receive messages on the CAN bus.
However, as soon as I import the USBHost library to access the USB port and recompile the program, the program freezes after few seconds.
2) Version 2: USBHost alone ==> OK I could write and read data on a memory stick connected to the USB port through the USBHostMSD class (part of the USBHost library)
3) Version 3: CAN + Data log on the mbed memory (without importing the USB host library) ==> OK I tried to log the CAN messages in a file on the mbed with the LocalFileSystem. It worked fine.
4) Version4: CAN + Data Log on a SD card through USB port ==> NG As soon as I import the USBHost library to the project the program just freezes when i try to write in a file, and this even before I declare any instance of the USB library or include the USBHostMSD.h header file.
After the program freeze issue, I tried to restore the Version 3 of the program by deleting the library from the project but the freeze issue remained.
Also, completely disconnecting the mbed from any source of power doesn't solve the issue.
The only solution I found to restore the version 3 without the USBHost library was to create a new project and make a copy/paste of the source code to the new project.
Any idea that could explain the freeze issue and the inability to restore the program by removing the USBHost library from the project?
Thanks in advance