Phosphonic acids minimize charge-transfer losses and improve coating of perovskites on micropyramidal silicon substrates.