What kind of cannon were they? Were you using canister shot? If so, how did you keep from mowing down your troops with the canister shot if they were in front of the cannon? If they were that other one that fires explosive shells, I can understand that...
Oh, and canister shot is the perfect weapon for massed infantry attackes.
I used canister shot and I probably did kill a few of my own men but the cannons were on kind of a small incline behind my troops, I didn't hit enough of my own to make them route or anything though and the general was nearby too so it keeps the morale up.