Connect NetBurner MOD5270 (DevKit) to external RS232 Device
Posted: Thu Mar 25, 2010 8:11 pm
Hi,
I want to connect NetBurner MOD5270 (devKit) to a Quadravox QT531 (MP3 player) using RS232 on UART0.
NetBurner COM0 is a DB9 female and Quadravox QT531 input is also a DB9 female.
I use a gender changer to connect my NetBurner to the Quadravox but nothing works.
I simply use OpenSerial function. Do I have to put specific jumper on the NetBurner (JP6 / JP13).
Is the gender changer a problem ? I have no idea.
Do I need to rewrite a serial driver ?
Code:
#include "predef.h"
#include <stdio.h>
#include <ctype.h>
#include <startnet.h>
#include <autoupdate.h>
#include <dhcpclient.h>
#include <NetworkDebug.h>
#include <iosys.h>
#include <serial.h>
extern "C"
{
void UserMain(void * pd);
}
const char * AppName="Quadravox";
#define QUADRAVOX_RESET 0x27
#define QUADRAVOX_PLAY 0x00
char buffer[64];
void UserMain(void * pd)
{
InitializeStack();
if (EthernetIP == 0)
GetDHCPAddress();
OSChangePrio(MAIN_PRIO);
EnableAutoUpdate();
StartHTTP();
#ifdef _DEBUG
InitializeNetworkGDB_and_Wait();
#endif
SerialClose(0);
while (1)
{
OSTimeDly(TICKS_PER_SECOND);
int fd0 = OpenSerial(0, 9600, 1, 8, eParityNone);
SerialEnableTxFlow(0, 0);
SerialEnableRxFlow(0, 0);
SerialEnableHwTxFlow(0, 1);
SerialEnableHwRxFlow(0, 1);
Serial485HalfDupMode(0, 0);
if (fd0 > 0)
{
buffer[0] = QUADRAVOX_RESET;
int writeBytes = writeall(fd0, buffer, 1);
int readBytes = ReadWithTimeout(fd0, buffer, 64, TICKS_PER_SECOND*5);
buffer[0] = QUADRAVOX_PLAY + 1;
writeBytes = writeall(fd0, buffer, 1);
readBytes = ReadWithTimeout(fd0, buffer, 64, TICKS_PER_SECOND*5);
SerialClose(0);
}
}
}
I want to connect NetBurner MOD5270 (devKit) to a Quadravox QT531 (MP3 player) using RS232 on UART0.
NetBurner COM0 is a DB9 female and Quadravox QT531 input is also a DB9 female.
I use a gender changer to connect my NetBurner to the Quadravox but nothing works.
I simply use OpenSerial function. Do I have to put specific jumper on the NetBurner (JP6 / JP13).
Is the gender changer a problem ? I have no idea.
Do I need to rewrite a serial driver ?
Code:
#include "predef.h"
#include <stdio.h>
#include <ctype.h>
#include <startnet.h>
#include <autoupdate.h>
#include <dhcpclient.h>
#include <NetworkDebug.h>
#include <iosys.h>
#include <serial.h>
extern "C"
{
void UserMain(void * pd);
}
const char * AppName="Quadravox";
#define QUADRAVOX_RESET 0x27
#define QUADRAVOX_PLAY 0x00
char buffer[64];
void UserMain(void * pd)
{
InitializeStack();
if (EthernetIP == 0)
GetDHCPAddress();
OSChangePrio(MAIN_PRIO);
EnableAutoUpdate();
StartHTTP();
#ifdef _DEBUG
InitializeNetworkGDB_and_Wait();
#endif
SerialClose(0);
while (1)
{
OSTimeDly(TICKS_PER_SECOND);
int fd0 = OpenSerial(0, 9600, 1, 8, eParityNone);
SerialEnableTxFlow(0, 0);
SerialEnableRxFlow(0, 0);
SerialEnableHwTxFlow(0, 1);
SerialEnableHwRxFlow(0, 1);
Serial485HalfDupMode(0, 0);
if (fd0 > 0)
{
buffer[0] = QUADRAVOX_RESET;
int writeBytes = writeall(fd0, buffer, 1);
int readBytes = ReadWithTimeout(fd0, buffer, 64, TICKS_PER_SECOND*5);
buffer[0] = QUADRAVOX_PLAY + 1;
writeBytes = writeall(fd0, buffer, 1);
readBytes = ReadWithTimeout(fd0, buffer, 64, TICKS_PER_SECOND*5);
SerialClose(0);
}
}
}