Nucleo F401RE and GPS (MTK3339)


I’m currently trying to read data from a GPS ( ) with a Nucleo F401RE. I’ve discovered this library that is supposed to work (

I took a code from the git and adapted it to my board :

#include "mbed.h"
#include "MTK3339.h"
static int waitData = 0;
static MTK3339 gps(D8,D2);
Serial pc(USBTX,USBRX); 
static void dataAvailable() {
waitData |= gps.getAvailableDataType();
int main(void) {
gps.start(&dataAvailable, (MTK3339::NmeaGga|MTK3339::NmeaVtg));
while(1) {
    while(waitData == 0);
    if ((waitData & MTK3339::NmeaGga) != 0) {
        waitData &= ~(MTK3339::NmeaGga);
        pc.printf("gpa: fix=%d, sats=%d, alt=%f, lat=%f, lon=%f\n", 
            gps.gga.fix, gps.gga.satellites, gps.gga.altitude, 
            gps.getLatitudeAsDegrees(), gps.getLongitudeAsDegrees());            
    if ((waitData & MTK3339::NmeaVtg) != 0) {
        waitData &= ~(MTK3339::NmeaVtg);
        pc.printf("vtg: course=%f, speed=%f km/h, mode=%c\n", 
            gps.vtg.course, gps.vtg.speedKmHour, gps.vtg.mode);            
    waitData &= (MTK3339::NmeaGga|MTK3339::NmeaVtg);

But when I try it, I have an error called something like “Mutex , not permitted in ISR”.

I’m currently working on Mbed-Studio with MbedOs 5.15.4

Do you have any idea of what might be the source of my problem ?

Many thanks

Hi there,

problem is the library is old and with MbedOS5.11 or 5.12 there were added Mutexes to all methods what manipulate with in/output.
There exist RawSerial API (In MbedOS6+ UnbufferedSerial), not contain Mutexes.

BR, Jan