2015年10月17日土曜日

設計ミス

やってしまった.

11号機製作中,センサLEDがどうしても光らないので原因を調べてみると,DMAコントローラがエラーを出している.

LED発光タイミングはDMACで制御.ポートをたたけるDMAはチャネル2のみ.チャネル2のDMAを起動できるタイマはTIM1のみ.TIM1はモータドライバに使っている.モータドライバのつながっているピンにはTIM1以外のタイマを割り当てられない.

自由度の高いSTM32とはいえ,かなりきついぞ,これは...詰んだか.

9 件のコメント:

Nakashima さんのコメント...

昔はこんなこと
http://kojimousenote.blogspot.jp/2010/10/blog-post_11.html
してましたし、空中配線はお手の物だと信じてますよ(^^)

ところで、中部へのエントリー締め切りは明日です。よろしくお願いします。

w谷 さんのコメント...

DMA関連は自由度低いですよね。
DMAだけはルネサスのが自由度高い感じでした。
シリアル受信イベントで、全然関係ない処理起動したりとか。
あり得ない設定とかもできたけど、STM32は基本決め打ちなので...

Unknown さんのコメント...

DMA for IR sensor only saves the ADC sample time. Not worth that much efforts to make it work.

Kojima さんのコメント...

そんなこともしていましたねえ.毎年何かしら意図せず面倒な半田付け作業をするはめになっているような気がします.
でも今年の密度では空中配線もほぼ不可能.

DMAは自由度低いですね.使い方がほぼ決まっているというか.
間接的にでもどうにかならないかと思いましたがちょっと無理そうです.

I want to sample at 8kHz for encoders and at 64kHz in total including photo sensors. So, A/D conversion and LED control processes are desired to be performed without CPU. DMA is a key to do this. I will use alternative method to send triggers to DMAC.

Unknown さんのコメント...

oh, I thought you only amplify your encoder sinusoidal signal to make it low resolution square wave to feed quadrature encoder module in STM32. So you are using STM32 to do some digital processing for sinusoidal input directly from your customized encoder to achieve more resolution? In this case having ADC continuously driving by DMA seems necessary. Did you use look up table or FPU to do the math? and how much CPU time that the math computation would occupy on every 1ms without counting the DMA ADC sampling time? how much encoder resolution that you ended up achieving?

Kojima さんのコメント...

For encoders, I just get square pulses using ADC as you think. But, encoder emitters are driven with pulse signal like photo sensors in order to reduce battery consumption. The pulse is controlled by write I/O port state in the register by using DMA trasfer.

The sequence of my photo sensor and encoder sampling is as follows.
1. Turn on LED for a photo sensor or encoder using DMA which is triggered by a timer.
2. A/D conversion is performed, which is also triggered by the timer. Then, A/D data is trasfferd by DMA.
3. Turn off LED using DMA triggered by the timer.

There are 18 teeth in my encoder, and so, 8kHz is necessary to obtain correct square waves at the target maximum speed, which is 4 m/s.

Unknown さんのコメント...

thanks for your detailed explanation. That looks like a lot of trade off in order to reduce the weight by using customized encoder. If the output is amplified to square wave through op-amp, why don't use digital input instead of ADC? Or you can slower the encoder IR LED current to keep it on all the time then use quadrature encoder module in stm32 to pick up amplified square wave automatically? I bet you did such a test already. Or you can do sinusoidal signal process on every control cycle between phase A and B as long as the it won't exceed the 1/4 of the period of the sinusoidal wave. Anyway, your method looks very challenge to me :D
I would rather to use magnetic encoder with extra weight by adding extra battery to compensate the lose of driving force.

Kojima さんのコメント...

The output signal of photo transistor is actually amplified, but the signal is still small. So digital input port cannot detect a rising or falling edge. This is because I use ADC to detect the pulses of the encoder. Although this encoder is very challenging, its small size and weight is large benefit.

Unknown さんのコメント...

no wonder you can't amply it to square wave. Since you used such a system to detect forward speed by fusion encoder and accelerometer data. Would you mind share the equation that you combine the encoder and accelerometer data into a usable speed for controller? Thank you.

コメントを投稿