diff options
| author | Brian Schwind <[email protected]> | 2025-10-04 13:05:26 +0900 |
|---|---|---|
| committer | Brian Schwind <[email protected]> | 2025-10-04 16:52:20 +0900 |
| commit | 5e89631367c88e636899ddc3b3d333c92d0a983e (patch) | |
| tree | 71515d1f9e72e46a4d740b33813be99f9a313c0e | |
| parent | 617dd353637d5d99e47c357f9115f6f96144ed6b (diff) | |
ospi: properly configure the transfer size
| -rw-r--r-- | embassy-stm32/src/ospi/mod.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/embassy-stm32/src/ospi/mod.rs b/embassy-stm32/src/ospi/mod.rs index 76e6b46eb..a1f3c8b03 100644 --- a/embassy-stm32/src/ospi/mod.rs +++ b/embassy-stm32/src/ospi/mod.rs | |||
| @@ -577,7 +577,8 @@ impl<'d, T: Instance, M: PeriMode> Ospi<'d, T, M> { | |||
| 577 | w.set_dmaen(false); | 577 | w.set_dmaen(false); |
| 578 | }); | 578 | }); |
| 579 | 579 | ||
| 580 | self.configure_command(&transaction, Some(buf.len()))?; | 580 | let transfer_size_bytes = buf.len() * W::size().bytes(); |
| 581 | self.configure_command(&transaction, Some(transfer_size_bytes))?; | ||
| 581 | 582 | ||
| 582 | let current_address = T::REGS.ar().read().address(); | 583 | let current_address = T::REGS.ar().read().address(); |
| 583 | let current_instruction = T::REGS.ir().read().instruction(); | 584 | let current_instruction = T::REGS.ir().read().instruction(); |
| @@ -616,7 +617,8 @@ impl<'d, T: Instance, M: PeriMode> Ospi<'d, T, M> { | |||
| 616 | w.set_dmaen(false); | 617 | w.set_dmaen(false); |
| 617 | }); | 618 | }); |
| 618 | 619 | ||
| 619 | self.configure_command(&transaction, Some(buf.len()))?; | 620 | let transfer_size_bytes = buf.len() * W::size().bytes(); |
| 621 | self.configure_command(&transaction, Some(transfer_size_bytes))?; | ||
| 620 | 622 | ||
| 621 | T::REGS | 623 | T::REGS |
| 622 | .cr() | 624 | .cr() |
| @@ -1153,7 +1155,8 @@ impl<'d, T: Instance> Ospi<'d, T, Async> { | |||
| 1153 | // Wait for peripheral to be free | 1155 | // Wait for peripheral to be free |
| 1154 | while T::REGS.sr().read().busy() {} | 1156 | while T::REGS.sr().read().busy() {} |
| 1155 | 1157 | ||
| 1156 | self.configure_command(&transaction, Some(buf.len()))?; | 1158 | let transfer_size_bytes = buf.len() * W::size().bytes(); |
| 1159 | self.configure_command(&transaction, Some(transfer_size_bytes))?; | ||
| 1157 | 1160 | ||
| 1158 | let current_address = T::REGS.ar().read().address(); | 1161 | let current_address = T::REGS.ar().read().address(); |
| 1159 | let current_instruction = T::REGS.ir().read().instruction(); | 1162 | let current_instruction = T::REGS.ir().read().instruction(); |
| @@ -1193,7 +1196,8 @@ impl<'d, T: Instance> Ospi<'d, T, Async> { | |||
| 1193 | // Wait for peripheral to be free | 1196 | // Wait for peripheral to be free |
| 1194 | while T::REGS.sr().read().busy() {} | 1197 | while T::REGS.sr().read().busy() {} |
| 1195 | 1198 | ||
| 1196 | self.configure_command(&transaction, Some(buf.len()))?; | 1199 | let transfer_size_bytes = buf.len() * W::size().bytes(); |
| 1200 | self.configure_command(&transaction, Some(transfer_size_bytes))?; | ||
| 1197 | T::REGS | 1201 | T::REGS |
| 1198 | .cr() | 1202 | .cr() |
| 1199 | .modify(|v| v.set_fmode(vals::FunctionalMode::INDIRECT_WRITE)); | 1203 | .modify(|v| v.set_fmode(vals::FunctionalMode::INDIRECT_WRITE)); |
| @@ -1226,7 +1230,8 @@ impl<'d, T: Instance> Ospi<'d, T, Async> { | |||
| 1226 | // Wait for peripheral to be free | 1230 | // Wait for peripheral to be free |
| 1227 | while T::REGS.sr().read().busy() {} | 1231 | while T::REGS.sr().read().busy() {} |
| 1228 | 1232 | ||
| 1229 | self.configure_command(&transaction, Some(buf.len()))?; | 1233 | let transfer_size_bytes = buf.len() * W::size().bytes(); |
| 1234 | self.configure_command(&transaction, Some(transfer_size_bytes))?; | ||
| 1230 | 1235 | ||
| 1231 | let current_address = T::REGS.ar().read().address(); | 1236 | let current_address = T::REGS.ar().read().address(); |
| 1232 | let current_instruction = T::REGS.ir().read().instruction(); | 1237 | let current_instruction = T::REGS.ir().read().instruction(); |
| @@ -1266,7 +1271,8 @@ impl<'d, T: Instance> Ospi<'d, T, Async> { | |||
| 1266 | // Wait for peripheral to be free | 1271 | // Wait for peripheral to be free |
| 1267 | while T::REGS.sr().read().busy() {} | 1272 | while T::REGS.sr().read().busy() {} |
| 1268 | 1273 | ||
| 1269 | self.configure_command(&transaction, Some(buf.len()))?; | 1274 | let transfer_size_bytes = buf.len() * W::size().bytes(); |
| 1275 | self.configure_command(&transaction, Some(transfer_size_bytes))?; | ||
| 1270 | T::REGS | 1276 | T::REGS |
| 1271 | .cr() | 1277 | .cr() |
| 1272 | .modify(|v| v.set_fmode(vals::FunctionalMode::INDIRECT_WRITE)); | 1278 | .modify(|v| v.set_fmode(vals::FunctionalMode::INDIRECT_WRITE)); |
