[Ovmsdev] CAN transmit problems - Think City vehicle_thinkcity.c
Håkon Markussen
hakon.markussen at gmail.com
Mon Aug 26 03:59:56 HKT 2013
Hi,
I've met a problem to which I need some help.
I need to request some parameters from one ECU, and try to transmit on the can-bus from the OVMS-module.
Whatever I do, the sys_features[FEATURE_CANWRITE] is always "0" and the transmission will never take place.
I have tried to set the sys_features[FEATURE_CANWRITE] to "1", but as explained in the dev-doc, the TXB0CONbits.TXREQ will never go true and the module will reboot.
The receiver of the request (RX-part) works fine, I've tested that by transmitting manually with PCANView.
I have tried to put the TX-statements in the poll1, ticker1 and currently; in an idle poll (as in vehicle.teslaroadster.c) which has a hook in
vehicle_fn_idlepoll = &vehicle_thinkcity_idlepoll;
I've debugged a bit and found that:
FEATURE_CANWRITE = 15
sys_features[FEATURE_CANWRITE] = 0
right before the if-test begin.
I would be happy if anyone have some helpful hints :-)
BOOL vehicle_thinkcity_idlepoll(void)
{
if (sys_features[FEATURE_CANWRITE]>0)
{
while (TXB0CONbits.TXREQ) {} // Loop until TX is done
TXB0CON = 0;
TXB0SIDL = 0b01100000; // msg 753 03 22 49 67
TXB0SIDH = 0b11101010;
TXB0D0 = 0x03;
TXB0D1 = 0x22;
TXB0D2 = 0x49;
TXB0D3 = 0x67;
TXB0DLC = 0b0000100; // data length (4)
TXB0CON = 0b00001000; // mark for transmission
}
return FALSE;
}
Best regards
Håkon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20130825/96b7c899/attachment.htm>
More information about the OvmsDev
mailing list