In the reference manual the LPSPI Status Register (SR) shows the RDF and TDF flags are read-only (see section 220.127.116.11.2). In the AN5413 cookbook the flags are written to 1 to clear them (e.g. in the function LPSPI1_receive_16bits). Is this necessary? Why do the flags need to be written when they are read-only? Is the Application Note correct or is the Reference Manual correct?