So I have two systems, each with an IRDA emitter/receiver/transceiver soldered to UART pins on an STM32F103, along with a general purpose serial output which I plug into my computer for debug purposes.
Now I can't get these to communicate ! I have setup both serials, one with a regular 9600 bauds/sec config, the other with the same rate but with the "UART_CR3_IREN" mask on the last SerialConfig structure member, and made sure the "ShutDown" pin on my IRDA device was cleared. What am I missing ? Or should I look for board.h definition errors ?
Note : the macro at the beginning changes the behavior from IRDA emitter to IRDA receiver. The receiver sends 'r' after every 5 sec timeout on the IRDA serial, the emitter just sends 'x' all the time.
Note 2 : I do receive the receiver's 'r's (along with an unknown character) every 5 seconds. But no 'x' ...
Thanks in advance for the tips and help ! You guys rock and I love Chibi.
Code: Select all
#include "ch.h"
#include "hal.h"
#define EMITTER 1
// Serial configs : enable IRDA for one, and use a normal config for the other
static const SerialConfig irda_cfg = {9600, 0, 0, USART_CR3_IREN};
static const SerialConfig normal_cfg = {9600, 0, 0, 0};
int main (void) {
halInit();
chSysInit();
// Make sure IRDA is on (ShutDown at 0)
palClearPad(GPIOA, SD_IRDA2);
// IRDA2 on PC10/11 through USART3
sdStart(&SD3, &irda_cfg);
// Output serial
sdStart(&SD1, &normal_cfg);
while(1) {
if(EMITTER) {
sdPut(&SD3, 'x');
}
else {
sdPut(&SD1, 'r');
sdPut(&SD1, sdGetTimeout(&SD3, 5000));
}
}
}