He added: "I am confident the revolution will succeed and the coup will vanish."
Morsi's son, Osama, is a member of his defence team.
In his letter, Morsi commented on the decision to send his death sentence to the grand mufti for an opinion. The case has become known in the media as "the escape from the Wadi al-Natrun Prison".
"The death sentence did not affect me. It is not different from the decision of a sniper who kills this person or wounds that one. I stick to my principles and stances in confronting the coup," he wrote.
|I extend my condolences to all families of the martyrs and applaud the steadfastness of all prisoners and the oppressed.
"I extend my condolences to all families of the martyrs and applaud the steadfastness of all prisoners and the oppressed. The revolution will get them their rights back and fulfil all their demands."
Morsi met his son for 15 minutes in a courtroom at the Police Academy. He has also been charged with "insulting the judiciary."
His son reported that the ousted president said a day would come when those who staged the coup would stand trial.
"I am not afraid, and I am confident that we, in the course of the revolution, will bring them to court and the trials will happen soon. I promise the revolutionaries that I will not be less courageous and steadfast than they are, and I will stick to my principles and stances in confronting the coup," he wrote.
"The revolution is charting for itself a course clearer than before. Egypt has clearly realised who the enemies of the revolution and the homeland are."
No retreat, no surrender
Morsi added: "The solution is for the revolution to complete its course without any retreat... The coup leaders seek to break the will of the revolution. I call on everyone to complete the revolution without fear."
Morsi said: "It is the revolution that will bring rights back and punish the murderers."
He said he believes the administration of President Abdelfattah al-Sisi to be failing, and that maintaining the revolution's demands and goals would result in the defeat of his coup.
"Those judges who keep me behind a glass partition are too weak for an encounter without this partition." He would not stoop to their "vulgar behaviour", he said.
Osama, Morsi's son, said his father had been most concerned by the plight of everyday citizens.
"The most important thing he was keen to ask me about from the outset of the meeting was the situation of the Egyptians, prices, gasoline, supplies, and bread," said Osama. "I informed him of the bad situation, and he said 'the revolution will make things better. Don't worry.'"
Morsi has long since put his faith in the revolutionary spirit that brought down Hosni Mubarak.
"The revolution is the best solution," he wrote. "The coup will go from failure to failure and will not last. We will not stop seeking the punishment of the killers, and no one can give up on that."
Morsi's son said his father remained steadfast.
"President Mohamed Morsi is stronger than before," said Osama. "He has this impressive determination that the revolution will triumph over this coup and that the revolutionaries must complete their revolution. He remains optimistic."
This is an edited translation from our Arabic edition.