Starting a new build

Started by Chewy1576, February 12, 2018, 07:34:30 PM

Chewy1576

It compiles without errors  ;D

I haven't had a chance to wire or code the whole CAN interface yet. Hopefully in the next day or two...

Chewy1576

Well my CAN communication code doesn't seem to be working. Using the CAN initialization check from the examples, both processors seem to be activating and talking to their respective CAN boards, but the Uno side isn't sending messages out on the CAN BUS. I have the terminating resistor on the Pro Mini side jumpered on. I'm going to try breaking each float out into it's own CAN transaction.

Rx7man

yeah, I think that's a good idea anyhow
'94 dually,  67/67 HE351VE, NV5600, ~600hp
'93 ECLB 47RH, new toy truck, H pump project, 1000hp goal, 300K miles
93 XCLB auto, bone stock, 350K miles
93 XCLB 5spd, bone stock, 100K miles

Chewy1576

I think I figured out my problem...

The Pro Mini is running at 16 mhz, the CAN BUS board I have has an 8 Mhz oscillator. I didn't put in any kind of correction for the difference. I'm working on figuring out how to implement that now.

Rx7man

I dont' think that's a problem, I've used them like that before... though I was talking to two units that had the same frequency oscillators.. have to read the datasheet
'94 dually,  67/67 HE351VE, NV5600, ~600hp
'93 ECLB 47RH, new toy truck, H pump project, 1000hp goal, 300K miles
93 XCLB auto, bone stock, 350K miles
93 XCLB 5spd, bone stock, 100K miles

Chewy1576

I found another library that had a initialize parameter for an 8 MHz crystal, and it's working. Now I either redo my code for the new library, or swap out the 8 MHz crystal for a 16 MHz and use my original code.

Rx7man

'94 dually,  67/67 HE351VE, NV5600, ~600hp
'93 ECLB 47RH, new toy truck, H pump project, 1000hp goal, 300K miles
93 XCLB auto, bone stock, 350K miles
93 XCLB 5spd, bone stock, 100K miles

Chewy1576


Rx7man

Nice.. since I'm sure I'll run into that problem later, I'm glad to be aware of it now
'94 dually,  67/67 HE351VE, NV5600, ~600hp
'93 ECLB 47RH, new toy truck, H pump project, 1000hp goal, 300K miles
93 XCLB auto, bone stock, 350K miles
93 XCLB 5spd, bone stock, 100K miles

Chewy1576

I think I'm going to change out the crystal on the CAN board. I liked programming with the other library better. It's just 2 points to solder.

Rx7man

you MIGHT need to change the caps as well.. probably will work though
'94 dually,  67/67 HE351VE, NV5600, ~600hp
'93 ECLB 47RH, new toy truck, H pump project, 1000hp goal, 300K miles
93 XCLB auto, bone stock, 350K miles
93 XCLB 5spd, bone stock, 100K miles

Chewy1576

Since I got the Send/Receive working I figured I would expand on the Send side while I had a few minutes to tinker. I'm seeing all of the messages sent on the Receive side, but they come through in groups. I'd like to get it to send one set of data before the next, so I need to track down a way to pause between sends until an acknowledgement comes, or is this how CAN is supposed to work? The Receive side will take in all messages on the bus and filter them based on Message ID?

Rx7man

that's above my pay grade.. lol.. I mean you could make some generic ACK message and wait until you get an ACK before you send the next, though should anything ever happen to it it could hang...
Are you checking for a message every so often or are you using an interrupt?  I was able to send pretty darned fast when I used interrupts
'94 dually,  67/67 HE351VE, NV5600, ~600hp
'93 ECLB 47RH, new toy truck, H pump project, 1000hp goal, 300K miles
93 XCLB auto, bone stock, 350K miles
93 XCLB 5spd, bone stock, 100K miles

Chewy1576

No just cyclically in Loop. It's almost like a full auto shotgun blasting data on the bus. I feel like it should be more structured. I'm going to try using the interrupt next. If that doesn't work, I could try some kind of send sequence with handshaking, but that seems like it would bog things down on the VGT controller side.

Rx7man

What I did was send a different item every go-round, rather than everything at once.. If you have a millisecond timer going, that would be one way.. every millisecond (or whatever) you send the next packet
'94 dually,  67/67 HE351VE, NV5600, ~600hp
'93 ECLB 47RH, new toy truck, H pump project, 1000hp goal, 300K miles
93 XCLB auto, bone stock, 350K miles
93 XCLB 5spd, bone stock, 100K miles