Ferdinand died in January 1516 and was succeeded by his mentally unstable daughter Joanna. Within a few weeks, her son proclaimed himself her co-ruler as King Charles I of Castile and Aragon. Charles had been raised in Netherlands and his affairs were mostly controlled by the Flemish noble William de Croÿ, sieur de Chièvres.  In 1517, the seventeen-year-old King sailed to Castile, where he was formally recognised as King of Castile.  There, his Flemish court provoked much scandal, as de Croÿ shamelessly sold government privileges for personal money and installed other Flemish nobles into government offices.  In May 1518, Charles traveled to Barcelona in Aragon, where he would remain for nearly two years. Here, he haggled with Aragon's slightly stronger cortes, the Generalitat, for privileges and his formal recognition as King of Aragon. Aragon managed to maintain more local control than Castile did, but mostly because Aragon was poorer and there was no point in pressing the issue for extra tax money that wasn't there to be collected. In 1519, the King's paternal grandfather, Holy Roman Emperor Maximilian I, died.  Charles competed with King Francis I of France to win the imperial election by aggressively bribing prince-electors.  Charles won, becoming Emperor Charles V. He left Aragon to return to Castile to raise funds to pay down the debts he had incurred in the election.  The taxes granted to Charles at a Castilian cortes in Corunna would help spark the Revolt of the Comuneros of Castile.  Of more importance for Aragon, in the summer of 1519 Charles granted his permission to the Germanies to arm themselves against the raiding Muslim fleets. While permission had previously been granted under Ferdinand, Charles was able to force the Valencian nobles to accept this decision.. When did King Charles I become Emperor Charles V?