I am brand new to these boards. Maple and leaflabs forum.
I installed the three files from x893 into the proper locations and made the reccommended changes to allow for speed changes and the interrupt modifications and I am still having some problems. My program does not loop. When I run the following code (I have been moving comments around to try new things) it will output two correct messages. It will output the message from void 1 time and the message from loop 1 time (not looping). If I put a delay anywhere before the second send, it will not send anything. I think there is a problem in the libraries or core files, but I do not know enough to get it going. Can someone help me out with this or post/link code that does work? I am using Maple IDE 0.0.12
#include <HardwareCAN.h>
HardwareCAN canBus(CAN1_BASE);
void setup()
{
canBus.map(CAN_GPIO_PB8_PB9);
SerialUSB.end(); // Disable USB !!!
CAN_TX_MBX mbx;
CanMsg t_msg;
canBus.begin(CAN_SPEED_250, CAN_MODE_NORMAL);
canBus.filter(0, 0, 0);
//canBus.set_pool_mode();
canBus.set_irq_mode(); // use irq mode
t_msg.IDE = CAN_ID_EXT;
t_msg.RTR = CAN_RTR_DATA;
t_msg.ID = 0x0E55FF;
t_msg.DLC = 8;
t_msg.Data[0] = 0xAA;
t_msg.Data[1] = 0x55;
t_msg.Data[2] = 0x0;
t_msg.Data[3] = 0x0;
t_msg.Data[4] = 0x0;
t_msg.Data[5] = 0x0;
t_msg.Data[6] = 0x0;
t_msg.Data[7] = 0x98;
mbx = canBus.send(&t_msg);
// while(!canBus.fifo_ready(CAN_FIFO0))
// {
// delay(10);
// }
// canBus.read(CAN_FIFO0, &t_msg);
// canBus.release(CAN_FIFO0);
// while(!canBus.available())
// {
// delay(10);
// }
}
void loop()
{
CAN_TX_MBX mbx;
CanMsg t_msg;
t_msg.Data[0] = 0xAA;
t_msg.Data[1] = 0x55;
t_msg.Data[2] = 0x09;
t_msg.Data[3] = 0x08;
t_msg.Data[4] = 0x07;
t_msg.Data[5] = 0x06;
t_msg.Data[6] = 0x05;
t_msg.Data[7] = 0x98;
mbx = canBus.send(&t_msg);
// delay(100);
}