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 15import ttfw_idf 16from tiny_test_fw import TinyFW 17 18 19@ttfw_idf.idf_example_test(env_tag='Example_SDIO', ignore=True) 20def test_example_sdio_communication(env, extra_data): 21 """ 22 Configurations 23 dut1 = host -> dut2 = slave 24 should be in the same group of devices, otherwise may meet download issue 25 group1: (Wroom-32 Series or PICO-D4 modules: PICO-Kit, DevKitC, WroverKit v2 or earlier) 26 group2: (Wrover module: WroverKit v3) 27 28 GPIO14->GPIO14 29 GPIO15->GPIO15 30 GPIO2->GPIO2 31 GPIO4->GPIO4 32 GND->GND 33 34 VDD3.3 -> GPIO13 if dut2 uses WroverKit v3 35 36 or use sdio test board, which has two wrover modules connect to a same FT3232 37 Assume that first dut is host and second is slave 38 """ 39 dut1 = env.get_dut('sdio_host', 'examples/peripherals/sdio/host', dut_class=ttfw_idf.ESP32DUT) 40 dut2 = env.get_dut('sdio_slave', 'examples/peripherals/sdio/slave', dut_class=ttfw_idf.ESP32DUT) 41 dut1.start_app() 42 # wait until the master is ready to setup the slave 43 dut1.expect('host ready, start initializing slave...') 44 45 dut2.start_app() 46 dut1.expect('0a 0d 10 13 16 19 1c 1f 22 25 28 2b 2e 31 34 37') 47 dut1.expect('3a 3d 40 43 46 49 4c 4f 52 55 58 5b 00 00 00 00') 48 dut1.expect('6a 6d 70 73 76 79 7c 7f 82 85 88 8b 8e 91 94 97') 49 dut1.expect('9a 9d a0 a3 a6 a9 ac af b2 b5 b8 bb be c1 c4 c7') 50 51 dut2.expect('================ JOB_WRITE_REG ================') 52 dut2.expect('0a 0d 10 13 16 19 1c 1f 22 25 28 2b 2e 31 34 37') 53 dut2.expect('3a 3d 40 43 46 49 4c 4f 52 55 58 5b 00 00 00 00') 54 dut2.expect('6a 6d 70 73 76 79 7c 7f 82 85 88 8b 8e 91 94 97') 55 dut2.expect('9a 9d a0 a3 a6 a9 ac af b2 b5 b8 bb be c1 c4 c7') 56 57 dut1.expect('host int: 0') 58 dut1.expect('host int: 1') 59 dut1.expect('host int: 2') 60 dut1.expect('host int: 3') 61 dut1.expect('host int: 4') 62 dut1.expect('host int: 5') 63 dut1.expect('host int: 6') 64 dut1.expect('host int: 7') 65 dut1.expect('host int: 0') 66 dut1.expect('host int: 1') 67 dut1.expect('host int: 2') 68 dut1.expect('host int: 3') 69 dut1.expect('host int: 4') 70 dut1.expect('host int: 5') 71 dut1.expect('host int: 6') 72 dut1.expect('host int: 7') 73 74 dut2.expect('================ JOB_SEND_INT ================') 75 dut2.expect('================ JOB_SEND_INT ================') 76 77 dut1.expect('send packet length: 3') 78 dut1.expect('send packet length: 6') 79 dut1.expect('send packet length: 12') 80 dut1.expect('send packet length: 128') 81 dut1.expect('send packet length: 511') 82 dut1.expect('send packet length: 512') 83 84 dut2.expect('recv len: 3') 85 dut2.expect('recv len: 6') 86 dut2.expect('recv len: 12') 87 dut2.expect('recv len: 128') 88 # 511 89 dut2.expect('recv len: 128') 90 dut2.expect('recv len: 128') 91 dut2.expect('recv len: 128') 92 dut2.expect('recv len: 127') 93 # 512 94 dut2.expect('recv len: 128') 95 dut2.expect('recv len: 128') 96 dut2.expect('recv len: 128') 97 dut2.expect('recv len: 128') 98 99 dut1.expect('receive data, size: 3') 100 dut1.expect('receive data, size: 6') 101 dut1.expect('receive data, size: 12') 102 dut1.expect('receive data, size: 128') 103 104 dut1.expect('receive data, size: 128') 105 dut1.expect('receive data, size: 128') 106 dut1.expect('receive data, size: 128') 107 dut1.expect('receive data, size: 127') 108 109 dut1.expect('receive data, size: 128') 110 dut1.expect('receive data, size: 128') 111 dut1.expect('receive data, size: 128') 112 dut1.expect('receive data, size: 128') 113 114 # the last valid line of one round 115 dut1.expect('ce d3 d8 dd e2 e7 ec f1 f6 fb 00 05 0a 0f 14 19') 116 # the first 2 lines of the second round 117 dut1.expect('46 4b 50') 118 dut1.expect('5a 5f 64 69 6e 73') 119 120 121if __name__ == '__main__': 122 TinyFW.set_default_config(env_config_file='EnvConfigTemplate.yml', dut=ttfw_idf.IDFDUT) 123 test_example_sdio_communication() 124