File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
55and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
66
7+ ## [ Unreleased]
8+ ### Fixed
9+ - Fixed undefined behaviour in SPI full duplex RX DMA transfers.
10+
711## [ 0.6.0] - 2022-07-04
812### Added
913- Added ` rcc::Lsco ` to use the low-speed oscillator output.
Original file line number Diff line number Diff line change @@ -148,9 +148,12 @@ const fn cpol_from_polarity(polarity: Polarity) -> bool {
148148 }
149149}
150150
151+ // a space for the RX DMA to transfer into when TX'ing in full-duplex
152+ static mut GARBAGE : [ u8 ; 1 ] = [ 0 ] ;
153+
151154use sealed:: SpiRegs ;
152155pub ( crate ) mod sealed {
153- use super :: Error ;
156+ use super :: { Error , GARBAGE } ;
154157 use crate :: {
155158 dma:: { self , DmaCh } ,
156159 pac,
@@ -261,9 +264,7 @@ pub(crate) mod sealed {
261264 . set_mem_inc ( true )
262265 . set_enable ( true ) ;
263266
264- let garbage: [ u8 ; 1 ] = [ 0 ] ;
265-
266- rx_dma. set_mem_addr ( garbage. as_ptr ( ) as u32 ) ;
267+ rx_dma. set_mem_addr ( unsafe { GARBAGE . as_mut_ptr ( ) } as u32 ) ;
267268 tx_dma. set_mem_addr ( words. as_ptr ( ) as u32 ) ;
268269
269270 let ndt: u32 = words. len ( ) as u32 ;
You can’t perform that action at this time.
0 commit comments