Open 759401524 opened 3 years ago
Sorry about the delay. Somehow we missed this. Discussing offline now. Hopefully will have response early tomorrow.
Hi @759401524 Can you try the same model using a host only script and see if it works normally? (eg. either through depthai_demo, or some other experiment that just shows the results on the host). Also, when the ESP32 side displays that no packet was received, does the host side still continue to run, or it exits with some exception?
Can you try the same model using a host only script and see if it works normally? (eg. either through depthai_demo, or some other experiment that just shows the results on the host).
I tried it, and it works normally.
when the ESP32 side displays that no packet was received, does the host side still continue to run, or it exits with some exception?
test.tar.gz This is the test code and blob
Thanks @759401524 - I'll investigate and report back early next week hopefully
@themarpe any progress?
@759401524 Sorry, way behind. Giving this a test now.
@759401524
Can you reduce the SPI speed in esp32_spi_impl.c
to a smaller value eg 4MHz:
//Configuration for the SPI device on the other side of the bus
spi_device_interface_config_t devcfg={
.command_bits=0,
.address_bits=0,
.dummy_bits=0,
.clock_speed_hz=4000000,
// TODO(themarpe) - enable .clock_speed_hz=20000000
.duty_cycle_pos=128, //50% duty cycle
...
Seems to resolve the issue for the time being (we are yet to rewrite some parts of the SPI MCU communication stack to be better)
Can you reduce the SPI speed in
esp32_spi_impl.c
to a smaller value eg 4MHz
I tested it and it works
I tested it and it works
@themarpe Today, I tested it again, it doesn't work anymore
@themarpe I have the same problem
Can't enter if
To reduce the issues in this example, add an else statement to the req_message with a slight delay (eg usleep(1000))
Also, currently the issue with not being able to enter is usually when ESP32 starts before MX and keeps trying to communicate with MX. After MX boots up, it might start at middle of a reqest which desync the communication.
To address this currently, make sure that MX is started first and is up and ready, then start ESP32 example.
The issues are yet to be resolved - which will make the above obsolete and with better stability.
Thank you for your information.
We used gpio communication to notify esp32 that MX has started. When esp32 is notified, spi communication will be started.
Now, it works fine.
script = pipeline.create(dai.node.Script)
script.setScript(
"""
import time
import GPIO
# Pin 34, highCount (clock cycles), lowCount (clock cycles)
ret = GPIO.setup(34, GPIO.OUT)
GPIO.write(34, 1)
"""
)
@themarpe This demo can’t be compiled successfully, please help me see why
@jihuoguo290 seems like C++14 flags are missing.
Creating a fix for all of the projects in develop
branch
Pushed - make sure to use a develop
branch of DepthAI to go along
To reduce the issues in this example, add an else statement to the req_message with a slight delay (eg usleep(1000))
Also, currently the issue with not being able to enter is usually when ESP32 starts before MX and keeps trying to communicate with MX. After MX boots up, it might start at middle of a reqest which desync the communication.
To address this currently, make sure that MX is started first and is up and ready, then start ESP32 example.
The issues are yet to be resolved - which will make the above obsolete and with better stability.
Thank you for your information.
We used gpio communication to notify esp32 that MX has started. When esp32 is notified, spi communication will be started.
Now, it works fine.
script = pipeline.create(dai.node.Script) script.setScript( """ import time import GPIO # Pin 34, highCount (clock cycles), lowCount (clock cycles) ret = GPIO.setup(34, GPIO.OUT) GPIO.write(34, 1) """ )
esp32 side
void gpio_init(void)
{
gpio_config_t io_conf; // 定义一个gpio_config类型的结构体,下面的都算对其进行的配
io_conf.intr_type = GPIO_INTR_DISABLE; // 禁止中断
io_conf.mode = GPIO_MODE_OUTPUT; // 选择输出模式
io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL; // 配置GPIO_OUT寄存器
gpio_config(&io_conf); // 最后配置使能
}
static void tx_task(void *arg) { while (1) { gpio_init(); sendData("ESP", "HELLO"); vTaskDelay(2000 / portTICK_PERIOD_MS); } }
//Main application
void app_main()
{
init();
configGpio();
gpio_task_example(nullptr);
// init spi for the esp32
init_esp32_spi();
xTaskCreate(rx_task, "uart_rx_task", 10242, NULL, configMAX_PRIORITIES, NULL);
xTaskCreate(tx_task, "uart_tx_task", 10242, NULL, configMAX_PRIORITIES-1, NULL);
run_demo();
//Never reached.
deinit_esp32_spi();
}
when i config esp32 gpio2 as output ,esp32 can not connect to mx,@themarpe
Hi @jihuoguo290 Sorry for late response.
That pin is part of ESP32 bootstrap pins. Make sure to either set it up later once its sampled in the correct state or bring up the esp/mx in correct order (so that the GPIO2 is correct upon EPS32 bootup)
More information on that pin can be found here: https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32d_esp32-wroom-32u_datasheet_en.pdf (2.3 Strapping Pins)
how can i upload dap file via wifi, i find this demo https://github.com/luxonis/esp32-spi-message-demo/tree/feature/ota_server_ui/ota_test Unfortunately, it failed to compile successfully
Can you give me some advice,by the way dap file is greater than 4M. @themarpe @Luxonis-Brandon @Luxonis-Steven ,thanks
@jihuoguo290 make sure to create a "compressed" dap file, as NOR access on ESP32 uses 24bit addressing only at the time being, meaning that maximum 16MiB (2^24) can be accessed and correctly flashed.
(also there is 1MiB overhead for USB and 8MiB for NETWORK bootloaders at the beggining of flash)
Regarding the compilation issue - I've pushed a fix addressing that. Pull the latest changes and should compile as expected
@jihuoguo290 make sure to create a "compressed" dap file, as NOR access on ESP32 uses 24bit addressing only at the time being, meaning that maximum 16MiB (2^24) can be accessed and correctly flashed.
(also there is 1MiB overhead for USB and 8MiB for NETWORK bootloaders at the beggining of flash)
Regarding the compilation issue - I've pushed a fix addressing that. Pull the latest changes and should compile as expected
as you said ,i pull the latest code,greate news, Now the compilation has passed smoothly. what do you mean "compressed" dap file.now i got pipline.dap how can i compressed ,file size is
@jihuoguo290 Check: https://docs.luxonis.com/projects/api/en/latest/references/python/?highlight=saveDepthaiApplicationPackage#depthai.DeviceBootloader.saveDepthaiApplicationPackage
Add a compress=True
parameter to saveDepthaiApplicationPackage
call above.
Might also want to check about enabling 32bit addressing in that MT25Q driver.
(Note: please post text of code instead of pictures/screenshots as its easier to search afterwards, etc...)
how can i upload dap file via wifi, i find this demo https://github.com/luxonis/esp32-spi-message-demo/tree/feature/ota_server_ui/ota_test Unfortunately, it failed to compile successfully
Can you give me some advice,by the way dap file is greater than 4M. @themarpe @Luxonis-Brandon @Luxonis-Steven ,thanks
@themarpe when ota_test example bin file flash to esp32,it got
I (524) spi_flash: flash io: dio
W (528) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (541) FlashMT25Q: Initializing external SPI Flash
I (546) FlashMT25Q: Pin assignments:
I (550) FlashMT25Q: MOSI: 23 MISO: 19 SCLK: 18 CS: 5
**E (558) FlashMT25Q: Failed to initialize external Flash: ESP_ERR_FLASH_NOT_INITIALISED (0x6003)**
I (567) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (644) wifi:wifi driver task: 3ffc1864, prio:23, stack:6656, core=0
I (644) system_api: Base MAC address is not set
I (644) system_api: read default base MAC address from EFUSE
I (654) wifi:wifi firmware version: c7d0450
I (654) wifi:wifi certification version: v7.0
I (654) wifi:config NVS flash: enabled
I (654) wifi:config nano formating: disabled
I (664) wifi:Init data frame dynamic rx buffer num: 32
I (664) wifi:Init management frame dynamic rx buffer num: 32
I (674) wifi:Init management short buffer num: 32
I (674) wifi:Init dynamic tx buffer num: 32
I (684) wifi:Init static rx buffer size: 1600
I (684) wifi:Init static rx buffer num: 10
I (684) wifi:Init dynamic rx buffer num: 32
I (694) wifi_init: rx ba win: 6
I (694) wifi_init: tcpip mbox: 32
I (704) wifi_init: udp mbox: 6
I (704) wifi_init: tcp mbox: 6
I (704) wifi_init: tcp tx win: 5744
I (714) wifi_init: tcp rx win: 5744
I (714) wifi_init: tcp mss: 1440
I (724) wifi_init: WiFi IRAM OP enabled
I (724) wifi_init: WiFi RX IRAM OP enabled
I (734) example_connect: Connecting to NJMKX2.4G...
I (734) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (844) wifi:mode : sta (34:ab:95:82:b3:64)
I (844) wifi:enable tsf
I (854) example_connect: Waiting for IP(s)
I (884) wifi:new:<1,1>, old:<1,0>, ap:<255,255>, sta:<1,1>, prof:9
I (1614) wifi:state: init -> auth (b0)
I (1664) wifi:state: auth -> assoc (0)
I (1824) wifi:state: assoc -> run (10)
I (2734) wifi:connected with NJMKX2.4G, aid = 2, channel 1, 40U, bssid = 54:75:95:d1:bb:67
I (2734) wifi:security: WPA2-PSK, phy: bgn, rssi: -56
I (2734) wifi:pm start, type: 1
W (2744) wifi:<ba-add>idx:0 (ifx:0, 54:75:95:d1:bb:67), tid:6, ssn:2, winSize:64
I (2824) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (3634) esp_netif_handlers: example_connect: sta ip: 192.168.30.197, mask: 255.255.255.0, gw: 192.168.30.1
just faild to initialize external flash, is there anything wrong? by the way, with "compressed" dap file ,i got pipeline.dap file,but it's size is 21MB,Is the capacity too large?
@jihuoguo290 we'll have to check this one out. Feel free to experiment with it a bit - one thing to make sure is if the MX is kept in reset while this procedure is happening (can also manually hold it in reset using the button on IoT40)
Otherwise we'll circle back to this issue - but its currently not high on our list of tasks to do.
Yeah, the size might be too large in this case. Not sure though if this driver properly handles 32bit addressing or not.
CC: @Erol444
@themarpe ,when i flash dap file to nor flash on mx .No booted (bootloader) devices found when i connect with computer. when reset device with https://github.com/luxonis/depthai/blob/UI-test-tools-Production/esp_flash_test.py , it return to normal
I wonder is it dap file start address is right :
@jihuoguo290
The offset is correct for USB bootloader.
I assume that its the issue with 24bit addressing in that case then... Would have to check if there any any drivers for this kind of NOR chips that support 32bit addressing
When the temperature of the MX chip exceeds 78 degrees Celsius, the communication between MX and esp32 will be disconnected, and the temperature of the MX will not cool down after the SPI communication is disconnected. Have you encountered this problem ?@themarpe
I ran the device-yolo-parsing demo on OAK-D-IOT-40 use the default blob tiny-yolo-v3.blob.sh4cmx4NCE1, The code runs normally, and the esp32 output is normal through the serial debugging tool.
But using other models, such as the model here, it only runs normally for 1-2 seconds and the esp32 output displays
Timeout: no response from remote device... failed to recv packet
Is there any special requirements for the
yolo
model when converting to a blob ?depthai version