stm32F765VGT with FatFS での書き込み応答時間

stm32F765VGTでFatFSを使い4096Byteのデータを連続して書き込むファイル書き込みテストで書き込み処理に要する時間を計測してみました。
SDMMCのクロックは48/(11+2)=3.7MHzです。
tim 5:5279 の5は1mSタイマー割り込みのカウント値、5279は1uSのクロックでインクリメントするタイマーのカウント値で、タイマーカウントがオーバーフローする場合のためにタイマー割り込みのカウント値を合わせて表示しています。

殆どの場合5~6msの処理時間で書き込み処理が終わるのですが、

FileWrite tim 5:5279 4096 Bytes written.
FileWrite tim 6:5259 4096 Bytes written.
FileWrite tim 5:5265 4096 Bytes written.
FileWrite tim 5:5318 4096 Bytes written.
FileWrite tim 6:5326 4096 Bytes written.
FileWrite tim 5:5189 4096 Bytes written.
FileWrite tim 5:5200 4096 Bytes written.
FileWrite tim 6:5263 4096 Bytes written.
FileWrite tim 5:5278 4096 Bytes written.
FileWrite tim 5:5260 4096 Bytes written.
FileWrite tim 6:5217 4096 Bytes written.
FileWrite tim 5:5270 4096 Bytes written.
FileWrite tim 6:5325 4096 Bytes written.
FileWrite tim 5:5189 4096 Bytes written.
FileWrite tim 5:5203 4096 Bytes written.
FileWrite tim 5:5267 4096 Bytes written.
FileWrite tim 5:5285 4096 Bytes written.
FileWrite tim 6:5269 4096 Bytes written.
FileWrite tim 5:5253 4096 Bytes written.
FileWrite tim 5:5291 4096 Bytes written.
FileWrite tim 6:5303 4096 Bytes written.
FileWrite tim 5:5158 4096 Bytes written.
FileWrite tim 5:5295 4096 Bytes written.
FileWrite tim 6:5242 4096 Bytes written.
FileWrite tim 5:5285 4096 Bytes written.
FileWrite tim 6:5316 4096 Bytes written.
FileWrite tim 5:5299 4096 Bytes written.
FileWrite tim 5:5289 4096 Bytes written.
FileWrite tim 6:5304 4096 Bytes written.
FileWrite tim 5:5157 4096 Bytes written.
FileWrite tim 5:5323 4096 Bytes written.
FileWrite tim 6:5242 4096 Bytes written.
FileWrite tim 5:5286 4096 Bytes written.
FileWrite tim 6:5317 4096 Bytes written.
FileWrite tim 5:5253 4096 Bytes written.
FileWrite tim 5:5289 4096 Bytes written.
FileWrite tim 6:5304 4096 Bytes written.
FileWrite tim 5:5158 4096 Bytes written.
FileWrite tim 5:5294 4096 Bytes written.
FileWrite tim 6:5243 4096 Bytes written.
FileWrite tim 5:5285 4096 Bytes written.
FileWrite tim 5:5268 4096 Bytes written.
FileWrite tim 6:5253 4096 Bytes written.
FileWrite tim 5:5289 4096 Bytes written.
FileWrite tim 6:5333 4096 Bytes written.
FileWrite tim 5:5158 4096 Bytes written.
FileWrite tim 5:5294 4096 Bytes written.
FileWrite tim 6:5243 4096 Bytes written.
FileWrite tim 5:5287 4096 Bytes written.
FileWrite tim 5:5268 4096 Bytes written.
FileWrite tim 6:5253 4096 Bytes written.
FileWrite tim 5:5290 4096 Bytes written.
FileWrite tim 5:5332 4096 Bytes written.
FileWrite tim 5:5158 4096 Bytes written.
FileWrite tim 5:5323 4096 Bytes written.
FileWrite tim 6:5243 4096 Bytes written.
FileWrite tim 5:5285 4096 Bytes written.
FileWrite tim 5:5268 4096 Bytes written.
FileWrite tim 6:5252 4096 Bytes written.
FileWrite tim 5:5291 4096 Bytes written.
FileWrite tim 5:5305 4096 Bytes written.
FileWrite tim 6:5158 4096 Bytes written.
FileWrite tim 5:5294 4096 Bytes written.
FileWrite tim 5:5242 4096 Bytes written.
FileWrite tim 6:5286 4096 Bytes written.
FileWrite tim 5:5316 4096 Bytes written.
FileWrite tim 6:5298 4096 Bytes written.
FileWrite tim 5:5290 4096 Bytes written.
FileWrite tim 5:5305 4096 Bytes written.
FileWrite tim 6:5158 4096 Bytes written.
FileWrite tim 5:5294 4096 Bytes written.
FileWrite tim 5:5317 4096 Bytes written.
FileWrite tim 6:5334 4096 Bytes written.
FileWrite tim 5:5269 4096 Bytes written.
FileWrite tim 6:5253 4096 Bytes written.
FileWrite tim 5:5291 4096 Bytes written.
FileWrite tim 5:5308 4096 Bytes written.
FileWrite tim 6:5159 4096 Bytes written.
FileWrite tim 5:5323 4096 Bytes written.
FileWrite tim 5:5243 4096 Bytes written.
FileWrite tim 6:5287 4096 Bytes written.
FileWrite tim 5:5269 4096 Bytes written.
FileWrite tim 5:5301 4096 Bytes written.
FileWrite tim 5:5321 4096 Bytes written.
FileWrite tim 5:5304 4096 Bytes written.
FileWrite tim 6:5159 4096 Bytes written.
FileWrite tim 5:5294 4096 Bytes written.
FileWrite tim 5:5242 4096 Bytes written.
FileWrite tim 6:5285 4096 Bytes written.
FileWrite tim 5:5268 4096 Bytes written.
FileWrite tim 5:5252 4096 Bytes written.
FileWrite tim 6:5249 4096 Bytes written.
FileWrite tim 5:5263 4096 Bytes written.
FileWrite tim 8:8010 4096 Bytes written.
FileWrite tim 6:5309 4096 Bytes written.
FileWrite tim 5:5285 4096 Bytes written.
FileWrite tim 7:6726 4096 Bytes written.
FileWrite tim 5:5212 4096 Bytes written.
FileWrite tim 6:5257 4096 Bytes written.
FileWrite tim 5:5282 4096 Bytes written.
FileWrite tim 5:5267 4096 Bytes written.
FileWrite tim 6:5160 4096 Bytes written.
FileWrite tim 5:5376 4096 Bytes written.
FileWrite tim 5:5320 4096 Bytes written.
FileWrite tim 6:5290 4096 Bytes written.
FileWrite tim 5:5212 4096 Bytes written.
FileWrite tim 5:5257 4096 Bytes written.
FileWrite tim 6:5281 4096 Bytes written.
FileWrite tim 5:5266 4096 Bytes written.
FileWrite tim 5:5101 4096 Bytes written.
FileWrite tim 6:5339 4096 Bytes written.
FileWrite tim 5:5315 4096 Bytes written.
FileWrite tim 6:5290 4096 Bytes written.
FileWrite tim 5:5212 4096 Bytes written.
FileWrite tim 5:5257 4096 Bytes written.
FileWrite tim 6:5281 4096 Bytes written.
FileWrite tim 5:5268 4096 Bytes written.
FileWrite tim 5:5150 4096 Bytes written.
FileWrite tim 6:5337 4096 Bytes written.
FileWrite tim 5:5313 4096 Bytes written.
FileWrite tim 5:5289 4096 Bytes written.
FileWrite tim 5:5212 4096 Bytes written.
FileWrite tim 5:5258 4096 Bytes written.
FileWrite tim 6:5280 4096 Bytes written.
FileWrite tim 5:5314 4096 Bytes written.
FileWrite tim 5:5206 4096 Bytes written.
FileWrite tim 6:5368 4096 Bytes written.
FileWrite tim 5:5314 4096 Bytes written.
FileWrite tim 6:5289 4096 Bytes written.
FileWrite tim 5:5212 4096 Bytes written.
FileWrite tim 5:5258 4096 Bytes written.
FileWrite tim 6:5281 4096 Bytes written.
FileWrite tim 5:5268 4096 Bytes written.
FileWrite tim 5:5161 4096 Bytes written.
FileWrite tim 6:5339 4096 Bytes written.
FileWrite tim 5:5316 4096 Bytes written.
FileWrite tim 5:5289 4096 Bytes written.
FileWrite tim 6:5212 4096 Bytes written.
FileWrite tim 5:5257 4096 Bytes written.
FileWrite tim 5:5330 4096 Bytes written.
FileWrite tim 5:5313 4096 Bytes written.
FileWrite tim 5:5147 4096 Bytes written.
FileWrite tim 6:5368 4096 Bytes written.
FileWrite tim 5:5314 4096 Bytes written.
FileWrite tim 5:5290 4096 Bytes written.
FileWrite tim 6:5212 4096 Bytes written.
FileWrite tim 5:5306 4096 Bytes written.
FileWrite tim 5:5259 4096 Bytes written.
FileWrite tim 6:5303 4096 Bytes written.
FileWrite tim 5:5344 4096 Bytes written.
FileWrite tim 6:5205 4096 Bytes written.
FileWrite tim 5:5372 4096 Bytes written.
FileWrite tim 5:5249 4096 Bytes written.

次のようにたまに最大で0.5秒を超える遅延が発生します。

FileWrite tim 15:14621 4096 Bytes written.
FileWrite tim 11:11137 4096 Bytes written.
FileWrite tim 524:57386 4096 Bytes written.
FileWrite tim 58:57534 4096 Bytes written.
FileWrite tim 59:57966 4096 Bytes written.
FileWrite tim 5:5258 4096 Bytes written.
FileWrite tim 5:5216 4096 Bytes written.
FileWrite tim 6:5269 4096 Bytes written.
FileWrite tim 5:5328 4096 Bytes written.
FileWrite tim 5:5191 4096 Bytes written.
FileWrite tim 6:5199 4096 Bytes written.
FileWrite tim 5:5263 4096 Bytes written.

連続して送られてくるデータをバッファリングしながら書き込みを行っているときに大きな遅延が発生するとその間に送られてくるデータを貯められるサイズのバッファがないとデータの取りこぼしが発生します。

例えば128Byte/1mSでデータが送られてくるとすれば64KByteのデータでは512mS以上の遅れでオーバーフローしてしまいます。

stm32F765には512KByteのRAMがあるので受信割り込みでデータを読み込めば128KByte以上のバッファを作れますが、DMAのCircularモードを使ってデータを受信する場合は0xffffがバッファサイズの限界なのでデータ転送量が128Byte/1mSに近づくとたまにエラーが発生することになります。

 

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です