The difference between canon and cannon is irregularly slight. Both are nouns; both are pronounced the same; and both refrain from using an "s" at the end of the word. So it really does come down to whether the word has one "n" or two "n's" in the middle.
So let's look at the difference between canon and cannon, along with examples of correct usage!
Canon vs. Cannon
Canon is a noun that most commonly refers to an accepted principle or rule that is followed or an authoritative list of books or texts. It can also refer to a particular contrapuntal musical composition or member of the clergy.
Cannon is, on the other hand, is a noun that refers to a giant gun that is usually, though not always, mounted on wheels. Also, the plural form of cannon is cannon. At one point, the cannon was a common weapon, though it's now mostly used in ceremonies or as artifacts.
Let's go through a few examples:
Correct: In the Stars Wars universe, there is some debate about whether books and comics are part of the Star Wars canon.
Incorrect: In the Stars Wars universe, there is some debate about whether books and comics are part of the Star Wars cannon.
Correct: As the soldiers approached the castle, we fired a cannon to discourage them.
Incorrect: As the soldiers approached the castle, we fired a canon to discourage them.
Correct: It's accepted as canon that more than one cannon is still referred to as cannon.
Incorrect: It's accepted as cannon that more than one canon is still referred to as canon.
So if you ever find yourself trying to remember how many n's you need, just remember that it takes two n's for the big gun cannon and one n for the little rule or collection of books.
No matter what type of writing you do, mastering the fundamentals of grammar and mechanics is an important first step to having a successful writing career.