Over the centuries, the three doors, San Pietro, San Donato and Santa Maria, were closed as darkness arrived. Those who stayed outside had to wait until dawn to re-enter. Only during exceptional events such as the visit of Charles V in 1536 did the gates remain open.
The last gate built was that of San Donato. Designed by Muzio Oddi and begun in 1628, it was completed in 1639. It was controlled by a structure called "castello" that represented one of the focal points of the defensive system of the City Walls. Evidence of its importance is provided by the penalties for failure to guard it: the castellan could be exiled if he strayed from his post and if he let in a foreigner, his life depended on it.
The last to be built, Porta San Donato was the first to remain open during the night. This was decided by the General Council in 1777, also establishing the obligation to pay a toll for crossing at night. Doctors, surgeons, apothecaries and nannies were exempt.