Sadly (I do know how you feel, you know) the only way open the cannon outside the castle is to collect all 150 stars. When you have done this, just walk up to it and it should be open. If you have an Action Replay card, however, there is almost certainly a cheat you can use to get the cannon before this.
Chat with our AI personalities
Collect 120 stars
Collect all 120 stars and go to the cannon outside. If you are playing super Mario 64 ds get all 150 stars and go to the cannon outside.
Get all 150 stars
If you mean the outside cannon you have to collect 120 stars. If you're talking about the ones in the courses you have to talk to a bob-bob buddy (pink bob-bob).
You cannon play multiplayer mini games in Super Mario 64 DS. Are you sure you don't mean New Super Mario Brothers? It has multiplayer mini games.