chip_data = (struct can_lmc1_chip_data*) candev->chip[chipnr]->chip_data;
btc = &chip_data->btc;
-
+
// set bittiming constants
btc->tseg1_min = 1;
btc->tseg1_max = 16;
int lpc17xx_pre_write_config(struct canchip_t *chip, struct msgobj_t *obj,
struct canmsg_t *msg)
{
+ uint32_t i=0;
+ // check status of TB1
+ while (!(can_read_reg(chip, CAN_SR_o) & CAN_SR_TBS1)){
+ if(i++<MAX_TRANSMIT_WAIT_LOOPS)
+ continue;
+
+ // request command to abort transmission request
+ can_write_reg(chip, CAN_CMR_AT, CAN_CMR_o);
+ return 0;
+ }
+
CAN_send(chip, msg);
return 0;
if(i++<MAX_TRANSMIT_WAIT_LOOPS)
continue;
+ CANMSG("Abort transmission request\n");
+
// request command to abort transmission request
can_write_reg(chip, CAN_CMR_AT, CAN_CMR_o);
break;
uint32_t i;
struct msgobj_t *obj;
obj = chip->msgobj[0];
-
i = can_read_reg(chip, CAN_ICR_o);
//debug print
- printf("BRP: %d, SJW: %d, TSEG1: %d, TSEG2: %d \n", brp+1, sjw+1, tseg1+1, tseg2+1);
+ CANMSG("BRP: %d, SJW: %d, TSEG1: %d, TSEG2: %d \n", brp+1, sjw+1, tseg1+1, tseg2+1);
can_disable_irq(chip->chip_irq);
volatile uint32_t can_tfi1;
uint32_t i=0;
- // check status of TB1
- while (!(can_read_reg(chip, CAN_SR_o) & CAN_SR_TBS1)){
- if(i++<MAX_TRANSMIT_WAIT_LOOPS)
- continue;
-
- // request command to abort transmission request
- can_write_reg(chip, CAN_CMR_AT, CAN_CMR_o);
- return;
- }
-
can_tfi1 = can_read_reg(chip, CAN_TFI1_o);
can_tfi1 &= ~0x000F0000;