diff options
| author | Brian Schwind <[email protected]> | 2025-10-04 13:30:06 +0900 |
|---|---|---|
| committer | Brian Schwind <[email protected]> | 2025-10-04 20:14:39 +0900 |
| commit | f471f72d3173f91ebbc1b6eb797278e7ff988e4e (patch) | |
| tree | dc46df30034794074fbfd0e007d78065c0cb7c64 /embassy-stm32 | |
| parent | 2e46fbf3c94b226ffd07a8c3d0730e138f4f168e (diff) | |
xspi: properly configure the transfer size
Diffstat (limited to 'embassy-stm32')
| -rw-r--r-- | embassy-stm32/src/xspi/mod.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/embassy-stm32/src/xspi/mod.rs b/embassy-stm32/src/xspi/mod.rs index cfc24422a..1f051bffe 100644 --- a/embassy-stm32/src/xspi/mod.rs +++ b/embassy-stm32/src/xspi/mod.rs | |||
| @@ -538,8 +538,8 @@ impl<'d, T: Instance, M: PeriMode> Xspi<'d, T, M> { | |||
| 538 | w.set_dmaen(false); | 538 | w.set_dmaen(false); |
| 539 | }); | 539 | }); |
| 540 | 540 | ||
| 541 | // self.configure_command(&transaction, Some(buf.len()))?; | 541 | let transfer_size_bytes = buf.len() * W::size().bytes(); |
| 542 | self.configure_command(&transaction, Some(buf.len())).unwrap(); | 542 | self.configure_command(&transaction, Some(transfer_size_bytes))?; |
| 543 | 543 | ||
| 544 | let current_address = T::REGS.ar().read().address(); | 544 | let current_address = T::REGS.ar().read().address(); |
| 545 | let current_instruction = T::REGS.ir().read().instruction(); | 545 | let current_instruction = T::REGS.ir().read().instruction(); |
| @@ -578,7 +578,8 @@ impl<'d, T: Instance, M: PeriMode> Xspi<'d, T, M> { | |||
| 578 | w.set_dmaen(false); | 578 | w.set_dmaen(false); |
| 579 | }); | 579 | }); |
| 580 | 580 | ||
| 581 | self.configure_command(&transaction, Some(buf.len()))?; | 581 | let transfer_size_bytes = buf.len() * W::size().bytes(); |
| 582 | self.configure_command(&transaction, Some(transfer_size_bytes))?; | ||
| 582 | 583 | ||
| 583 | T::REGS | 584 | T::REGS |
| 584 | .cr() | 585 | .cr() |
| @@ -1145,7 +1146,8 @@ impl<'d, T: Instance> Xspi<'d, T, Async> { | |||
| 1145 | // Wait for peripheral to be free | 1146 | // Wait for peripheral to be free |
| 1146 | while T::REGS.sr().read().busy() {} | 1147 | while T::REGS.sr().read().busy() {} |
| 1147 | 1148 | ||
| 1148 | self.configure_command(&transaction, Some(buf.len()))?; | 1149 | let transfer_size_bytes = buf.len() * W::size().bytes(); |
| 1150 | self.configure_command(&transaction, Some(transfer_size_bytes))?; | ||
| 1149 | 1151 | ||
| 1150 | let current_address = T::REGS.ar().read().address(); | 1152 | let current_address = T::REGS.ar().read().address(); |
| 1151 | let current_instruction = T::REGS.ir().read().instruction(); | 1153 | let current_instruction = T::REGS.ir().read().instruction(); |
| @@ -1185,7 +1187,8 @@ impl<'d, T: Instance> Xspi<'d, T, Async> { | |||
| 1185 | // Wait for peripheral to be free | 1187 | // Wait for peripheral to be free |
| 1186 | while T::REGS.sr().read().busy() {} | 1188 | while T::REGS.sr().read().busy() {} |
| 1187 | 1189 | ||
| 1188 | self.configure_command(&transaction, Some(buf.len()))?; | 1190 | let transfer_size_bytes = buf.len() * W::size().bytes(); |
| 1191 | self.configure_command(&transaction, Some(transfer_size_bytes))?; | ||
| 1189 | T::REGS | 1192 | T::REGS |
| 1190 | .cr() | 1193 | .cr() |
| 1191 | .modify(|v| v.set_fmode(Fmode::from_bits(XspiMode::IndirectWrite.into()))); | 1194 | .modify(|v| v.set_fmode(Fmode::from_bits(XspiMode::IndirectWrite.into()))); |
| @@ -1215,7 +1218,8 @@ impl<'d, T: Instance> Xspi<'d, T, Async> { | |||
| 1215 | // Wait for peripheral to be free | 1218 | // Wait for peripheral to be free |
| 1216 | while T::REGS.sr().read().busy() {} | 1219 | while T::REGS.sr().read().busy() {} |
| 1217 | 1220 | ||
| 1218 | self.configure_command(&transaction, Some(buf.len()))?; | 1221 | let transfer_size_bytes = buf.len() * W::size().bytes(); |
| 1222 | self.configure_command(&transaction, Some(transfer_size_bytes))?; | ||
| 1219 | 1223 | ||
| 1220 | let current_address = T::REGS.ar().read().address(); | 1224 | let current_address = T::REGS.ar().read().address(); |
| 1221 | let current_instruction = T::REGS.ir().read().instruction(); | 1225 | let current_instruction = T::REGS.ir().read().instruction(); |
| @@ -1255,7 +1259,8 @@ impl<'d, T: Instance> Xspi<'d, T, Async> { | |||
| 1255 | // Wait for peripheral to be free | 1259 | // Wait for peripheral to be free |
| 1256 | while T::REGS.sr().read().busy() {} | 1260 | while T::REGS.sr().read().busy() {} |
| 1257 | 1261 | ||
| 1258 | self.configure_command(&transaction, Some(buf.len()))?; | 1262 | let transfer_size_bytes = buf.len() * W::size().bytes(); |
| 1263 | self.configure_command(&transaction, Some(transfer_size_bytes))?; | ||
| 1259 | T::REGS | 1264 | T::REGS |
| 1260 | .cr() | 1265 | .cr() |
| 1261 | .modify(|v| v.set_fmode(Fmode::from_bits(XspiMode::IndirectWrite.into()))); | 1266 | .modify(|v| v.set_fmode(Fmode::from_bits(XspiMode::IndirectWrite.into()))); |
