sdio_test.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http:#www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import ttfw_idf
  15. from tiny_test_fw import TinyFW
  16. @ttfw_idf.idf_example_test(env_tag='Example_SDIO', ignore=True)
  17. def test_example_sdio_communication(env, extra_data):
  18. """
  19. Configurations
  20. dut1 = host -> dut2 = slave
  21. should be in the same group of devices, otherwise may meet download issue
  22. group1: (Wroom-32 Series or PICO-D4 modules: PICO-Kit, DevKitC, WroverKit v2 or earlier)
  23. group2: (Wrover module: WroverKit v3)
  24. GPIO14->GPIO14
  25. GPIO15->GPIO15
  26. GPIO2->GPIO2
  27. GPIO4->GPIO4
  28. GND->GND
  29. VDD3.3 -> GPIO13 if dut2 uses WroverKit v3
  30. or use sdio test board, which has two wrover modules connect to a same FT3232
  31. Assume that first dut is host and second is slave
  32. """
  33. dut1 = env.get_dut('sdio_host', 'examples/peripherals/sdio/host', dut_class=ttfw_idf.ESP32DUT)
  34. dut2 = env.get_dut('sdio_slave', 'examples/peripherals/sdio/slave', dut_class=ttfw_idf.ESP32DUT)
  35. dut1.start_app()
  36. # wait until the master is ready to setup the slave
  37. dut1.expect('host ready, start initializing slave...')
  38. dut2.start_app()
  39. dut1.expect('0a 0d 10 13 16 19 1c 1f 22 25 28 2b 2e 31 34 37')
  40. dut1.expect('3a 3d 40 43 46 49 4c 4f 52 55 58 5b 00 00 00 00')
  41. dut1.expect('6a 6d 70 73 76 79 7c 7f 82 85 88 8b 8e 91 94 97')
  42. dut1.expect('9a 9d a0 a3 a6 a9 ac af b2 b5 b8 bb be c1 c4 c7')
  43. dut2.expect('================ JOB_WRITE_REG ================')
  44. dut2.expect('0a 0d 10 13 16 19 1c 1f 22 25 28 2b 2e 31 34 37')
  45. dut2.expect('3a 3d 40 43 46 49 4c 4f 52 55 58 5b 00 00 00 00')
  46. dut2.expect('6a 6d 70 73 76 79 7c 7f 82 85 88 8b 8e 91 94 97')
  47. dut2.expect('9a 9d a0 a3 a6 a9 ac af b2 b5 b8 bb be c1 c4 c7')
  48. dut1.expect('host int: 0')
  49. dut1.expect('host int: 1')
  50. dut1.expect('host int: 2')
  51. dut1.expect('host int: 3')
  52. dut1.expect('host int: 4')
  53. dut1.expect('host int: 5')
  54. dut1.expect('host int: 6')
  55. dut1.expect('host int: 7')
  56. dut1.expect('host int: 0')
  57. dut1.expect('host int: 1')
  58. dut1.expect('host int: 2')
  59. dut1.expect('host int: 3')
  60. dut1.expect('host int: 4')
  61. dut1.expect('host int: 5')
  62. dut1.expect('host int: 6')
  63. dut1.expect('host int: 7')
  64. dut2.expect('================ JOB_SEND_INT ================')
  65. dut2.expect('================ JOB_SEND_INT ================')
  66. dut1.expect('send packet length: 3')
  67. dut1.expect('send packet length: 6')
  68. dut1.expect('send packet length: 12')
  69. dut1.expect('send packet length: 128')
  70. dut1.expect('send packet length: 511')
  71. dut1.expect('send packet length: 512')
  72. dut2.expect('recv len: 3')
  73. dut2.expect('recv len: 6')
  74. dut2.expect('recv len: 12')
  75. dut2.expect('recv len: 128')
  76. # 511
  77. dut2.expect('recv len: 128')
  78. dut2.expect('recv len: 128')
  79. dut2.expect('recv len: 128')
  80. dut2.expect('recv len: 127')
  81. # 512
  82. dut2.expect('recv len: 128')
  83. dut2.expect('recv len: 128')
  84. dut2.expect('recv len: 128')
  85. dut2.expect('recv len: 128')
  86. dut1.expect('receive data, size: 3')
  87. dut1.expect('receive data, size: 6')
  88. dut1.expect('receive data, size: 12')
  89. dut1.expect('receive data, size: 128')
  90. dut1.expect('receive data, size: 128')
  91. dut1.expect('receive data, size: 128')
  92. dut1.expect('receive data, size: 128')
  93. dut1.expect('receive data, size: 127')
  94. dut1.expect('receive data, size: 128')
  95. dut1.expect('receive data, size: 128')
  96. dut1.expect('receive data, size: 128')
  97. dut1.expect('receive data, size: 128')
  98. # the last valid line of one round
  99. dut1.expect('ce d3 d8 dd e2 e7 ec f1 f6 fb 00 05 0a 0f 14 19')
  100. # the first 2 lines of the second round
  101. dut1.expect('46 4b 50')
  102. dut1.expect('5a 5f 64 69 6e 73')
  103. if __name__ == '__main__':
  104. TinyFW.set_default_config(env_config_file='EnvConfigTemplate.yml', dut=ttfw_idf.IDFDUT)
  105. test_example_sdio_communication()