If we want to allow cannons, yet prevent smaller guns being invented and technology in general from advancing at too rapid a pace, then instead of gunpowder we could base it on steam cannons. Such weapons might be useful for besieging a castle, but difficult to deploy effectively in a field battle (time needed to set them up & to heat them up, the need for test shots to get the aim right, the smoke from the fire revealing their location, etc) and absolutely useless for fast-paced small-scale skirmish actions. It also seems like the principle would be impossible or at least very difficult to adapt for handheld guns.