What is Android Things Raspberry Pi GPIO max frequency?

后端 未结 3 659
北恋
北恋 2020-12-11 11:14

Where can be found the characteristics of the switching speed of GPIO port for the Raspberry Pi 3 under Android Things like that?

3条回答
  •  萌比男神i
    2020-12-11 11:49

    Here goes the results with C: it's near 100kHz.

    Since I don't have a scope or proper equipment for these measures, here's what I did:

    A java method that measures time, and invokes a C method that is efficient for a big number of cycles. This was for simplicity only, and I believe it's enough to show that for high number of cycles the speed asymptotically reaches almost 100kHz:

    1 Iterations done in 501.38547 ms = 0.0019944734 kHz
    10000 Iterations done in 599.4385 ms = 16.68228 kHz
    100000 Iterations done in 1496.2832 ms = 66.83227 kHz
    1000000 Iterations done in 10275.258 ms = 97.32116 kHz
    2000000 Iterations done in 20104.879 ms = 99.47834 kHz
    

    Among other things that the C code must do is sit waiting for 500ms until the pin is configured properly.

    All code used for this measurement is available at https://github.com/fmatosqg/androidthings_ndk/tree/SO_speed_measurement, and I believe there still may be room for speed improvement. Though it uses a hack to write from C code, instructions available in the README.md.

提交回复
热议问题