first, I had to communicate between Crazyflie 2.0 and Gps module.(Ublox EVK-M8T or NEO-M8T)
I tested communication by Arduino. It was succeeded and there is no problem.
So, I edited Crazyflie 2.0 firmware. like this.(I referred to "Gtgps.c")
Code: Select all
//directory : src/deck/drivers/src/commUart.c
#define DEBUG_MODULE "uartDeck"
#include "debug.h"
#include "deck.h"
#include "deck_core.h"
#include "log.h"
#include "FreeRTOS.h"
#include "stdbool.h"
#include "timers.h"
#include "uart1.h"
#include "console.h"
#include "task.h"
//static xTimerHandle timer;
char cData;
void receiveData(void *param)
{
while(1)
{
char ch;
char msg[100]="";
uart1Getchar(&ch);
msg[0]=cData=ch;
if(ch=='$')
{
int i =1;
for(;ch!='\n';i++)
{
uart1Getchar(&ch);
msg[i] = cData= ch;
}
i++;
msg[i]='\0';
DEBUG_PRINT("%s",msg);
}
}
}
static void uartCommInit(DeckInfo *info)
{
uart1Init(9600);
xTaskCreate(receiveData, "commUart",configMINIMAL_STACK_SIZE, NULL, /*priority*/1, NULL);
DEBUG_PRINT("Inited uartComm deck.\n");
}
static const DeckDriver uartCommDriver = {
.name = "commUart",
.usedGpio = 0,
.init = uartCommInit,
};
DECK_DRIVER(uartCommDriver);
LOG_GROUP_START(myUartData)
LOG_ADD(LOG_UINT16, character, &cData)
LOG_GROUP_STOP(myUartData)
After few minutes. It occur problem.
Crazyflie was stopped and turned on M1, M4 LED in red.
#Q1
What's mean that M1, M4 turned on in red?
#Q2
Does any problem in my code?
p.s. I'm not good at English. I don't know if I explained well...