MAVLINK Library crashing Teensy 3.1 [Error 43]

Status
Not open for further replies.

Flydroid

Member
I've read about the Error 43 and had it before (flashed hex compiled for UNO).
I can always get it working by flashing the blink.ino.

Now i want to implement the MAVLINK telemtry protocol.
For the most basic usage you need to send a "heartbeat", with just a little bit of code:

Code:
#include <mavlink.h>

int system_type = MAV_FIXED_WING;
int autopilot_type = MAV_AUTOPILOT_GENERIC;
mavlink_message_t msg;
uint8_t buf[MAVLINK_MAX_PACKET_LEN];

void setup(){
  Serial.begin(115200);
  Serial.println("Serial online");
  pinMode(13, OUTPUT);
  Serial1.begin(57600);
  Serial.println("Mavlink online");
}

void loop(){
	digitalWrite(13, HIGH);
	heartbeat();
	//mav.air_speed();
	Serial.println("Heartbeat");
	digitalWrite(13, LOW);
	delay(500);
}

void heartbeat(){
	mavlink_msg_heartbeat_pack(100, 200, &msg, system_type, autopilot_type);
	uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);
	Serial1.write(buf, len);
}

I pretty much follow the http://qgroundcontrol.org/dev/mavlink_arduino_integration_tutorial tutorial
with View attachment mavlink.zip as header files.

I suspect that in the library some unsupported functions are used. But what could that be and how can i find it?



edit:
I got it working with the official c_library for Mavlink:
https://github.com/mavlink/c_library
The definitions and include functions are a bit different but should work.
 
Last edited:
Also had this problem. Traced it down to the existence of the "bittest.c" file in the library directory. When the mavlink library gets included in the Teensy sketch, the bittest.c file also gets compiled and included. The bittest.c file has a "main()" function in it and I think that's what messes up the Teensy. I removed the bittest.c file from the library directory and now things appear to be compiling and working properly. At least the Teensy isn't hanging or locking up and screwing up the USB interface as soon as the sketch is downloaded.
 
Status
Not open for further replies.
Back
Top