The castle games were played in the Shogun's castle by the best Japanese players of the day. The first castle game was in 1626.
In 1664, the castle games became annual (with a few gaps).
1667 is the first year in which more than one game was played.
Starting from 1669, the castle games became exhibitions -- games were actually played elsewhere beforehand, and only replayed in the castle.
The last castle games were held in 1861. In the last years of the Tokugawa Shogunate, the political turmoil ultimately leading to the Meiji Restoration disrupted many Japanese traditional ceremonies and institutions -- and Go was no exception. -- 1862 exhibition games became the last of the long tradition.
In 1951, the games were compiled into a series of ten books, Oshiro gofu.
Pok: The article at gobase.org is based on my translation of an essay by Masukawa Koichi. I have revised this translation and published it under the title The Castle Games of the Edo Period - An Eye-Witness Report.