11 years, 5 months ago.

Modserial doesn't work?

Hello

I know I've asked a lot questions about using "serial.h" etc. . However, there are more problems. Is it right that the serial (or modserial) libraries are outdated. I have tried all modserial libraries that were available, but it didn't work.

Maybe someone has an idea how I could manage that?

My code:

#include "mbed.h"
#include "MODSERIAL.h"

// Make TX buffer 1024bytes and RX buffer use 512bytes.
MODSERIAL pc(USBTX, USBRX, 256); // tx, rx
Serial RS485(p26, p25);
DigitalOut DTR (p21);


// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Hauptprogramm

int main()
{

// Setze die Baudrate des PCs auf 230400
    pc.baud (230400);

    // Setze die Baudrate von RS-485 auf 62500 Baud
    RS485.baud (62500);

    // Das Format von RS-485 ist 8 Bits, 1 Paritaetsbit und 1 Stopbit
    RS485.format(8,ParityForced1,1);

    // Um etwas empfangen zu koennen muss DTR immer gleich 0 sein
    DTR = 0;

// Increase the TX buffer from the default 256bytes to 1024bytes.
    if (pc.txBufferSetSize(1024) != MODSERIAL::Ok) {
        error("Failed to allocate memory for new buffer");
    }

    if (RS485.readable()) {
        pc.printf("%x ", RS485.getc());
    }
    
   // RS485.attach(&rxCallback, MODSERIAL::RxIrq);


}

The Libraries i've tried:

/media/uploads/Frazzy/library.jpg

The error messages:

/media/uploads/Frazzy/error.jpg

1 Answer

11 years, 5 months ago.

See the MODSERIAL cookbook page: http://mbed.org/cookbook/MODSERIAL

New mbed library broke it, and first version of new mbed library had broken serial interrupts, breaking modserial even further. Since apparently Andy hasnt gotten to uploading a working version yet I uploaded mine: http://mbed.org/users/Sissors/code/MODSERIAL/

I think it should work, but if you find a small bug tell me and i have a look if i can fix it easily.

Accepted Answer

It works. Thank you. If I had any problems, I will tell you.

posted by Franziska Gerlich 26 Nov 2012

If you don't understand german, please tell me, then I try in english later. :D

Ich sehe du kommst aus den Niederlanden, kannst du Deutsch?

Denn es gibt etwas größere Probleme die ich schlecht in Englisch beschreiben kann.

Also die mbed-library wurde anscheinend geupdated und seitdem funktioniert bei keinem neuen Projekt die Kompilierung.

Eines der Errors z.B.: "identifier "namespace" is undefined" in file "mbed.bldFileHandle.h", Line: 35, Col: 1

und es gibt bestimmt 30 Errors alle in filehandle.h aus der mbed-library. Ich kann keine Projekte mehr kompilieren, da irgendwas an der library verändert wurde, heute morgen ging dieses Projekt noch.

Bitte helf mir :D

posted by Franziska Gerlich 26 Nov 2012