sd card support, ice40 bugfixes and PSRAM test with FPGA passthrough added
This commit is contained in:
parent
159e1b3a01
commit
1b0acb6ecb
8 changed files with 8954 additions and 104 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -22,3 +22,6 @@
|
||||||
path = factory_test/components/spi-ice40
|
path = factory_test/components/spi-ice40
|
||||||
url = git@github.com:Nicolai-Electronics/esp32-component-spi-ice40.git
|
url = git@github.com:Nicolai-Electronics/esp32-component-spi-ice40.git
|
||||||
branch = master
|
branch = master
|
||||||
|
[submodule "factory_test/components/sdcard"]
|
||||||
|
path = factory_test/components/sdcard
|
||||||
|
url = git@github.com:Nicolai-Electronics/esp32-component-sdcard.git
|
||||||
|
|
1
factory_test/components/sdcard
Submodule
1
factory_test/components/sdcard
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 373cb8958df4107163645fd2f2bddbd349cab22a
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3c7ce5ba461f770d330c5a7a8a129b9f13568ed5
|
Subproject commit 9a42035f026f928e272f8e8647880475c84881c9
|
8680
factory_test/main/bitstream2.h
Normal file
8680
factory_test/main/bitstream2.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -4,6 +4,7 @@
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
#include "managed_i2c.h"
|
#include "managed_i2c.h"
|
||||||
#include "logo.h"
|
#include "logo.h"
|
||||||
|
#include "sdcard.h"
|
||||||
|
|
||||||
static const char *TAG = "hardware";
|
static const char *TAG = "hardware";
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ esp_err_t hardware_init() {
|
||||||
dev_ice40.pin_done = -1;
|
dev_ice40.pin_done = -1;
|
||||||
dev_ice40.pin_reset = -1;
|
dev_ice40.pin_reset = -1;
|
||||||
dev_ice40.pin_int = GPIO_INT_FPGA;
|
dev_ice40.pin_int = GPIO_INT_FPGA;
|
||||||
dev_ice40.spi_speed = 60000000; // 60MHz
|
dev_ice40.spi_speed = 23000000; // 23MHz
|
||||||
dev_ice40.spi_max_transfer_size = SPI_MAX_TRANSFER_SIZE;
|
dev_ice40.spi_max_transfer_size = SPI_MAX_TRANSFER_SIZE;
|
||||||
dev_ice40.get_done = ice40_get_done_wrapper;
|
dev_ice40.get_done = ice40_get_done_wrapper;
|
||||||
dev_ice40.set_reset = ice40_set_reset_wrapper;
|
dev_ice40.set_reset = ice40_set_reset_wrapper;
|
||||||
|
@ -121,6 +122,8 @@ esp_err_t hardware_init() {
|
||||||
ESP_LOGE(TAG, "Initializing BNO055 failed");
|
ESP_LOGE(TAG, "Initializing BNO055 failed");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//res = mount_sd(SD_CMD, SD_CLK, SD_D0, SD_PWR, "/sd", false, 5);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ ICE40* get_ice40();
|
||||||
#define GPIO_I2C_SYS_SCL 21
|
#define GPIO_I2C_SYS_SCL 21
|
||||||
#define GPIO_I2C_SYS_SDA 22
|
#define GPIO_I2C_SYS_SDA 22
|
||||||
#define I2C_BUS_SYS 0
|
#define I2C_BUS_SYS 0
|
||||||
#define I2C_SPEED_SYS 20000 // 20kHz
|
#define I2C_SPEED_SYS 20000 // 20 kHz
|
||||||
|
|
||||||
// PCA9555 IO expander
|
// PCA9555 IO expander
|
||||||
#define PCA9555_ADDR 0x26
|
#define PCA9555_ADDR 0x26
|
||||||
|
@ -62,7 +62,7 @@ ICE40* get_ice40();
|
||||||
#define GPIO_I2C_EXT_SCL 25
|
#define GPIO_I2C_EXT_SCL 25
|
||||||
#define GPIO_I2C_EXT_SDA 26
|
#define GPIO_I2C_EXT_SDA 26
|
||||||
#define I2C_BUS_EXT 1
|
#define I2C_BUS_EXT 1
|
||||||
#define I2C_SPEED_EXT 20000 // 20 kHz
|
#define I2C_SPEED_EXT 100000 // 100 kHz
|
||||||
|
|
||||||
// SPI bus
|
// SPI bus
|
||||||
#define GPIO_SPI_CLK 18
|
#define GPIO_SPI_CLK 18
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
#include <esp_err.h>
|
#include <esp_err.h>
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
#include "bitstream.h"
|
#include "bitstream2.h"
|
||||||
|
#include "managed_i2c.h"
|
||||||
|
|
||||||
static const char *TAG = "main";
|
static const char *TAG = "main";
|
||||||
|
|
||||||
|
@ -16,14 +17,13 @@ bool calibrate = true;
|
||||||
bool display_bno_value = true;
|
bool display_bno_value = true;
|
||||||
ILI9341* ili9341 = NULL;
|
ILI9341* ili9341 = NULL;
|
||||||
ICE40* ice40 = NULL;
|
ICE40* ice40 = NULL;
|
||||||
uint8_t* framebuffer = NULL;
|
|
||||||
|
|
||||||
void button_handler(uint8_t pin, bool value) {
|
void button_handler(uint8_t pin, bool value) {
|
||||||
switch(pin) {
|
switch(pin) {
|
||||||
case PCA9555_PIN_BTN_START: {
|
case PCA9555_PIN_BTN_START: {
|
||||||
printf("Start button %s\n", value ? "pressed" : "released");
|
printf("Start button %s\n", value ? "pressed" : "released");
|
||||||
if (value) {
|
if (value) {
|
||||||
esp_err_t res = ice40_load_bitstream(ice40, bitstream, bitstream_length);
|
esp_err_t res = ice40_load_bitstream(ice40, proto2_bin, proto2_bin_len);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to program the FPGA (%d)", res);
|
ESP_LOGE(TAG, "Failed to program the FPGA (%d)", res);
|
||||||
} else {
|
} else {
|
||||||
|
@ -117,20 +117,69 @@ void restart() {
|
||||||
esp_restart();
|
esp_restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t bno055_workaround(BNO055* device) {
|
void bno055_task(BNO055* bno055, bno055_vector_t* rotation_offset) {
|
||||||
bno055_opmode_t currentMode = 0;
|
|
||||||
esp_err_t res;
|
esp_err_t res;
|
||||||
res = bno055_get_mode(device, ¤tMode);
|
|
||||||
if (res != ESP_OK) return res;
|
bno055_vector_t acceleration, magnetism, orientation, rotation, linear_acceleration, gravity;
|
||||||
if (currentMode != BNO055_OPERATION_MODE_NDOF) {
|
|
||||||
printf("!!! Reconfigure BNO055 !!! (%u != %u)\n", currentMode, BNO055_OPERATION_MODE_NDOF);
|
|
||||||
res = bno055_set_power_mode(device, BNO055_POWER_MODE_NORMAL);
|
|
||||||
if (res != ESP_OK) return res;
|
|
||||||
|
|
||||||
res = bno055_set_mode(device, BNO055_OPERATION_MODE_NDOF);
|
/*res = bno055_get_vector(bno055, BNO055_VECTOR_ACCELEROMETER, &acceleration);
|
||||||
if (res != ESP_OK) return res;
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Acceleration failed to read %d\n", res);
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
res = bno055_get_vector(bno055, BNO055_VECTOR_MAGNETOMETER, &magnetism);
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Magnetic field to read %d\n", res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*res = bno055_get_vector(bno055, BNO055_VECTOR_GYROSCOPE, &orientation);
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Orientation failed to read %d\n", res);
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
res = bno055_get_vector(bno055, BNO055_VECTOR_EULER, &rotation);
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Rotation failed to read %d\n", res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*res = bno055_get_vector(bno055, BNO055_VECTOR_LINEARACCEL, &linear_acceleration);
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Linear acceleration failed to read %d\n", res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = bno055_get_vector(bno055, BNO055_VECTOR_GRAVITY, &gravity);
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Gravity failed to read %d\n", res);
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if (calibrate) {
|
||||||
|
rotation_offset->x = rotation.x;
|
||||||
|
rotation_offset->y = rotation.y;
|
||||||
|
rotation_offset->z = rotation.z;
|
||||||
|
calibrate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
rotation.x -= rotation_offset->x;
|
||||||
|
rotation.y -= rotation_offset->y;
|
||||||
|
rotation.z -= rotation_offset->z;
|
||||||
|
|
||||||
|
/*printf("\n\n");
|
||||||
|
printf("Acceleration (m/s²) x = %5.8f y = %5.8f z = %5.8f\n", acceleration.x, acceleration.y, acceleration.z);
|
||||||
|
printf("Magnetic field (uT) x = %5.8f y = %5.8f z = %5.8f\n", magnetism.x, magnetism.y, magnetism.z);
|
||||||
|
printf("Orientation (dps) x = %5.8f y = %5.8f z = %5.8f\n", orientation.x, orientation.y, orientation.z);
|
||||||
|
printf("Rotation (degrees) x = %5.8f y = %5.8f z = %5.8f\n", rotation.x, rotation.y, rotation.z);
|
||||||
|
printf("Linear acceleration (m/s²) x = %5.8f y = %5.8f z = %5.8f\n", linear_acceleration.x, linear_acceleration.y, linear_acceleration.z);
|
||||||
|
printf("Gravity (m/s²) x = %5.8f y = %5.8f z = %5.8f\n", gravity.x, gravity.y, gravity.z);*/
|
||||||
|
|
||||||
|
if (display_bno_value) {
|
||||||
|
printf("Magnetic (uT) x: %5.4f y: %5.4f z: %5.4f Rotation (deg): x: %5.4f y: %5.4f z: %5.4f \n", magnetism.x, magnetism.y, magnetism.z, rotation.x, rotation.y, rotation.z);
|
||||||
}
|
}
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void app_main(void) {
|
void app_main(void) {
|
||||||
|
@ -145,18 +194,22 @@ void app_main(void) {
|
||||||
ili9341 = get_ili9341();
|
ili9341 = get_ili9341();
|
||||||
ice40 = get_ice40();
|
ice40 = get_ice40();
|
||||||
|
|
||||||
framebuffer = heap_caps_malloc(ILI9341_BUFFER_SIZE, MALLOC_CAP_8BIT);
|
// LCD test
|
||||||
|
/*uint8_t* framebuffer = heap_caps_malloc(ILI9341_BUFFER_SIZE, MALLOC_CAP_8BIT);
|
||||||
if (framebuffer == NULL) {
|
if (framebuffer == NULL) {
|
||||||
ESP_LOGE(TAG, "Failed to allocate framebuffer");
|
ESP_LOGE(TAG, "Failed to allocate framebuffer");
|
||||||
restart();
|
restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*memset(framebuffer, 0, ILI9341_BUFFER_SIZE); // Clear framebuffer
|
memset(framebuffer, 0, ILI9341_BUFFER_SIZE); // Clear framebuffer
|
||||||
res = ili9341_write(ili9341, framebuffer);
|
res = ili9341_write(ili9341, framebuffer);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to write framebuffer to LCD");
|
ESP_LOGE(TAG, "Failed to write framebuffer to LCD");
|
||||||
restart();
|
restart();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
free(framebuffer);
|
||||||
|
*/
|
||||||
|
|
||||||
/* Print chip information */
|
/* Print chip information */
|
||||||
esp_chip_info_t chip_info;
|
esp_chip_info_t chip_info;
|
||||||
|
@ -173,84 +226,134 @@ void app_main(void) {
|
||||||
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
|
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
|
||||||
|
|
||||||
printf("Minimum free heap size: %d bytes\n", esp_get_minimum_free_heap_size());
|
printf("Minimum free heap size: %d bytes\n", esp_get_minimum_free_heap_size());
|
||||||
|
|
||||||
|
// Initialize the buttons
|
||||||
button_init();
|
button_init();
|
||||||
|
|
||||||
BNO055* bno055 = get_bno055();
|
// Test for connection to RP2040 and to the BNO055 over I2C
|
||||||
|
/*BNO055* bno055 = get_bno055();
|
||||||
bno055_vector_t acceleration, magnetism, orientation, rotation, linear_acceleration, gravity;
|
|
||||||
bno055_vector_t rotation_offset;
|
bno055_vector_t rotation_offset;
|
||||||
rotation_offset.x = 0;
|
rotation_offset.x = 0;
|
||||||
rotation_offset.y = 0;
|
rotation_offset.y = 0;
|
||||||
rotation_offset.z = 0;
|
rotation_offset.z = 0;
|
||||||
|
|
||||||
|
uint8_t data_out, data_in;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
I2C_REGISTER_FW_VER,
|
||||||
|
I2C_REGISTER_GPIO_DIR,
|
||||||
|
I2C_REGISTER_GPIO_IN,
|
||||||
|
I2C_REGISTER_GPIO_OUT,
|
||||||
|
I2C_REGISTER_LCD_MODE,
|
||||||
|
I2C_REGISTER_LCD_BACKLIGHT,
|
||||||
|
};
|
||||||
|
|
||||||
while (1) {
|
data_out = 1 << 2; // Proto 0 pin is output
|
||||||
//vTaskDelay(10 / portTICK_PERIOD_MS);
|
res = i2c_write_reg_n(I2C_BUS_EXT, 0x17, I2C_REGISTER_GPIO_DIR, &data_out, 1);
|
||||||
/*res = bno055_workaround(bno055);
|
if (res != ESP_OK) {
|
||||||
if (res != ESP_OK) {
|
ESP_LOGE(TAG, "Failed to set GPIO direction on Pico: %d", res);
|
||||||
ESP_LOGE(TAG, "Workaround failed %d\n", res);
|
return;
|
||||||
continue;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*res = bno055_get_vector(bno055, BNO055_VECTOR_ACCELEROMETER, &acceleration);
|
|
||||||
if (res != ESP_OK) {
|
|
||||||
ESP_LOGE(TAG, "Acceleration failed to read %d\n", res);
|
|
||||||
continue;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
res = bno055_get_vector(bno055, BNO055_VECTOR_MAGNETOMETER, &magnetism);
|
|
||||||
if (res != ESP_OK) {
|
|
||||||
ESP_LOGE(TAG, "Magnetic field to read %d\n", res);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*res = bno055_get_vector(bno055, BNO055_VECTOR_GYROSCOPE, &orientation);
|
|
||||||
if (res != ESP_OK) {
|
|
||||||
ESP_LOGE(TAG, "Orientation failed to read %d\n", res);
|
|
||||||
continue;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
res = bno055_get_vector(bno055, BNO055_VECTOR_EULER, &rotation);
|
|
||||||
if (res != ESP_OK) {
|
|
||||||
ESP_LOGE(TAG, "Rotation failed to read %d\n", res);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*res = bno055_get_vector(bno055, BNO055_VECTOR_LINEARACCEL, &linear_acceleration);
|
|
||||||
if (res != ESP_OK) {
|
|
||||||
ESP_LOGE(TAG, "Linear acceleration failed to read %d\n", res);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = bno055_get_vector(bno055, BNO055_VECTOR_GRAVITY, &gravity);
|
|
||||||
if (res != ESP_OK) {
|
|
||||||
ESP_LOGE(TAG, "Gravity failed to read %d\n", res);
|
|
||||||
continue;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (calibrate) {
|
|
||||||
rotation_offset.x = rotation.x;
|
|
||||||
rotation_offset.y = rotation.y;
|
|
||||||
rotation_offset.z = rotation.z;
|
|
||||||
calibrate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
rotation.x -= rotation_offset.x;
|
|
||||||
rotation.y -= rotation_offset.y;
|
|
||||||
rotation.z -= rotation_offset.z;
|
|
||||||
|
|
||||||
/*printf("\n\n");
|
|
||||||
printf("Acceleration (m/s²) x = %5.8f y = %5.8f z = %5.8f\n", acceleration.x, acceleration.y, acceleration.z);
|
|
||||||
printf("Magnetic field (uT) x = %5.8f y = %5.8f z = %5.8f\n", magnetism.x, magnetism.y, magnetism.z);
|
|
||||||
printf("Orientation (dps) x = %5.8f y = %5.8f z = %5.8f\n", orientation.x, orientation.y, orientation.z);
|
|
||||||
printf("Rotation (degrees) x = %5.8f y = %5.8f z = %5.8f\n", rotation.x, rotation.y, rotation.z);
|
|
||||||
printf("Linear acceleration (m/s²) x = %5.8f y = %5.8f z = %5.8f\n", linear_acceleration.x, linear_acceleration.y, linear_acceleration.z);
|
|
||||||
printf("Gravity (m/s²) x = %5.8f y = %5.8f z = %5.8f\n", gravity.x, gravity.y, gravity.z);*/
|
|
||||||
|
|
||||||
if (display_bno_value) {
|
|
||||||
printf("Magnetic (uT) x: %5.4f y: %5.4f z: %5.4f Rotation (deg): x: %5.4f y: %5.4f z: %5.4f \n", magnetism.x, magnetism.y, magnetism.z, rotation.x, rotation.y, rotation.z);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(framebuffer);
|
bool blink_state = false;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
data_out = blink_state << 2;
|
||||||
|
res = i2c_write_reg_n(I2C_BUS_EXT, 0x17, I2C_REGISTER_GPIO_OUT, &data_out, 1);
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Failed to set GPIO value on Pico: %d", res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
blink_state = !blink_state;
|
||||||
|
|
||||||
|
res = i2c_read_reg(I2C_BUS_EXT, 0x17, I2C_REGISTER_GPIO_IN, &data_in, 1);
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Failed to read GPIO value from Pico %d", res);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
printf("GPIO status: %02x\n", data_in);
|
||||||
|
}
|
||||||
|
bno055_task(bno055, &rotation_offset);
|
||||||
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// FPGA RAM passthrough test
|
||||||
|
|
||||||
|
res = ice40_load_bitstream(ice40, proto2_bin, proto2_bin_len);
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Failed to program the FPGA (%d)", res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* tx_buffer = malloc(SPI_MAX_TRANSFER_SIZE);
|
||||||
|
uint8_t* rx_buffer = malloc(SPI_MAX_TRANSFER_SIZE);
|
||||||
|
|
||||||
|
const uint8_t write_cmd = 0x02;
|
||||||
|
const uint8_t read_cmd = 0x03;
|
||||||
|
|
||||||
|
uint32_t size_of_ram = 8388608;
|
||||||
|
uint32_t position = 0;
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "Writing to PSRAM...");
|
||||||
|
int64_t tx_start_time = esp_timer_get_time();
|
||||||
|
while (position < size_of_ram) {
|
||||||
|
// First 4 bytes of the transmit buffer are used for CMD and 24-bit address
|
||||||
|
tx_buffer[0] = write_cmd;
|
||||||
|
tx_buffer[1] = (position >> 16);
|
||||||
|
tx_buffer[2] = (position >> 8) & 0xFF;
|
||||||
|
tx_buffer[3] = position & 0xFF;
|
||||||
|
|
||||||
|
uint32_t remaining = size_of_ram - position;
|
||||||
|
uint32_t data_length = SPI_MAX_TRANSFER_SIZE - 4;
|
||||||
|
if (data_length > remaining) data_length = remaining;
|
||||||
|
|
||||||
|
//
|
||||||
|
for (uint32_t index = 0; index < data_length; index++) {
|
||||||
|
tx_buffer[index + 4] = ((position + (index)) & 0xFF); // Generate a test pattern
|
||||||
|
}
|
||||||
|
if (ice40_transaction(ice40, tx_buffer, data_length + 4, rx_buffer, data_length + 4) != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Write transaction failed @ %u", remaining);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
position += data_length;
|
||||||
|
}
|
||||||
|
int64_t tx_done_time = esp_timer_get_time();
|
||||||
|
printf("Write took %lld microseconds\r\n", tx_done_time - tx_start_time);
|
||||||
|
uint64_t result = (((size_of_ram) / (tx_done_time - tx_start_time))*1000*1000)/1024;
|
||||||
|
printf("%u bytes in %lld microseconds = %llu kB/s\r\n", size_of_ram, tx_done_time - tx_start_time, result);
|
||||||
|
|
||||||
|
position = 0; // Reset position
|
||||||
|
memset(tx_buffer, 0, SPI_MAX_TRANSFER_SIZE); // Clear TX buffer
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "Verifying PSRAM contents...");
|
||||||
|
int64_t rx_start_time = esp_timer_get_time();
|
||||||
|
while (position < size_of_ram) {
|
||||||
|
tx_buffer[0] = read_cmd;
|
||||||
|
tx_buffer[1] = (position >> 16);
|
||||||
|
tx_buffer[2] = (position >> 8) & 0xFF;
|
||||||
|
tx_buffer[3] = position & 0xFF;
|
||||||
|
|
||||||
|
uint32_t remaining = size_of_ram - position;
|
||||||
|
uint32_t data_length = SPI_MAX_TRANSFER_SIZE - 4;
|
||||||
|
if (data_length > remaining) data_length = remaining;
|
||||||
|
|
||||||
|
if (ice40_transaction(ice40, tx_buffer, data_length + 4, rx_buffer, data_length + 4) != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Transaction failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t index = 0; index < data_length; index++) {
|
||||||
|
if (rx_buffer[index + 4] != ((position + (index)) & 0xFF)) { // Verify the test pattern
|
||||||
|
ESP_LOGE(TAG, "Verification failed @ %u + %u: %u != %u", position, index, rx_buffer[index + 4], (position + (index)) & 0xFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
position += data_length;
|
||||||
|
}
|
||||||
|
int64_t rx_done_time = esp_timer_get_time();
|
||||||
|
printf("Read took %lld microseconds\r\n", rx_done_time - rx_start_time);
|
||||||
|
result = (((size_of_ram) / (rx_done_time - rx_start_time))*1000*1000)/1024;
|
||||||
|
printf("%u bytes in %lld microseconds = %llu kB/s\r\n", size_of_ram, rx_done_time - rx_start_time, result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,6 +203,7 @@ CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y
|
||||||
#
|
#
|
||||||
# Security features
|
# Security features
|
||||||
#
|
#
|
||||||
|
CONFIG_SECURE_BOOT_SUPPORTS_RSA=y
|
||||||
# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set
|
# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set
|
||||||
# CONFIG_SECURE_BOOT is not set
|
# CONFIG_SECURE_BOOT is not set
|
||||||
# CONFIG_SECURE_FLASH_ENC_ENABLED is not set
|
# CONFIG_SECURE_FLASH_ENC_ENABLED is not set
|
||||||
|
@ -410,17 +411,73 @@ CONFIG_ESP_TLS_USING_MBEDTLS=y
|
||||||
#
|
#
|
||||||
# ESP32-specific
|
# ESP32-specific
|
||||||
#
|
#
|
||||||
|
CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y
|
||||||
# CONFIG_ESP32_REV_MIN_0 is not set
|
# CONFIG_ESP32_REV_MIN_0 is not set
|
||||||
CONFIG_ESP32_REV_MIN_1=y
|
# CONFIG_ESP32_REV_MIN_1 is not set
|
||||||
# CONFIG_ESP32_REV_MIN_2 is not set
|
# CONFIG_ESP32_REV_MIN_2 is not set
|
||||||
# CONFIG_ESP32_REV_MIN_3 is not set
|
CONFIG_ESP32_REV_MIN_3=y
|
||||||
CONFIG_ESP32_REV_MIN=1
|
CONFIG_ESP32_REV_MIN=3
|
||||||
CONFIG_ESP32_DPORT_WORKAROUND=y
|
|
||||||
# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set
|
# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set
|
||||||
# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set
|
# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set
|
||||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
||||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240
|
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240
|
||||||
# CONFIG_ESP32_SPIRAM_SUPPORT is not set
|
CONFIG_ESP32_SPIRAM_SUPPORT=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# SPI RAM config
|
||||||
|
#
|
||||||
|
CONFIG_SPIRAM_TYPE_AUTO=y
|
||||||
|
# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set
|
||||||
|
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
|
||||||
|
# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
|
||||||
|
CONFIG_SPIRAM_SIZE=-1
|
||||||
|
CONFIG_SPIRAM_SPEED_40M=y
|
||||||
|
# CONFIG_SPIRAM_SPEED_80M is not set
|
||||||
|
CONFIG_SPIRAM=y
|
||||||
|
CONFIG_SPIRAM_BOOT_INIT=y
|
||||||
|
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
|
||||||
|
# CONFIG_SPIRAM_USE_MEMMAP is not set
|
||||||
|
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
|
||||||
|
CONFIG_SPIRAM_USE_MALLOC=y
|
||||||
|
CONFIG_SPIRAM_MEMTEST=y
|
||||||
|
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384
|
||||||
|
# CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is not set
|
||||||
|
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
|
||||||
|
# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set
|
||||||
|
# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# SPIRAM cache workaround debugging
|
||||||
|
#
|
||||||
|
# end of SPIRAM cache workaround debugging
|
||||||
|
|
||||||
|
CONFIG_SPIRAM_BANKSWITCH_ENABLE=y
|
||||||
|
CONFIG_SPIRAM_BANKSWITCH_RESERVE=8
|
||||||
|
# CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# PSRAM clock and cs IO for ESP32-DOWD
|
||||||
|
#
|
||||||
|
CONFIG_D0WD_PSRAM_CLK_IO=17
|
||||||
|
CONFIG_D0WD_PSRAM_CS_IO=16
|
||||||
|
# end of PSRAM clock and cs IO for ESP32-DOWD
|
||||||
|
|
||||||
|
#
|
||||||
|
# PSRAM clock and cs IO for ESP32-D2WD
|
||||||
|
#
|
||||||
|
CONFIG_D2WD_PSRAM_CLK_IO=9
|
||||||
|
CONFIG_D2WD_PSRAM_CS_IO=10
|
||||||
|
# end of PSRAM clock and cs IO for ESP32-D2WD
|
||||||
|
|
||||||
|
#
|
||||||
|
# PSRAM clock and cs IO for ESP32-PICO
|
||||||
|
#
|
||||||
|
CONFIG_PICO_PSRAM_CS_IO=10
|
||||||
|
# end of PSRAM clock and cs IO for ESP32-PICO
|
||||||
|
|
||||||
|
# CONFIG_SPIRAM_2T_MODE is not set
|
||||||
|
# end of SPI RAM config
|
||||||
|
|
||||||
# CONFIG_ESP32_TRAX is not set
|
# CONFIG_ESP32_TRAX is not set
|
||||||
CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0
|
CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0
|
||||||
# CONFIG_ESP32_ULP_COPROC_ENABLED is not set
|
# CONFIG_ESP32_ULP_COPROC_ENABLED is not set
|
||||||
|
@ -546,9 +603,9 @@ CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4
|
||||||
#
|
#
|
||||||
# Sleep Config
|
# Sleep Config
|
||||||
#
|
#
|
||||||
CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y
|
|
||||||
CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y
|
CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y
|
||||||
# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set
|
# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set
|
||||||
|
# CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND is not set
|
||||||
# CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND is not set
|
# CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND is not set
|
||||||
# end of Sleep Config
|
# end of Sleep Config
|
||||||
|
|
||||||
|
@ -665,15 +722,16 @@ CONFIG_ESP_TIMER_IMPL_TG0_LAC=y
|
||||||
CONFIG_ESP32_WIFI_ENABLED=y
|
CONFIG_ESP32_WIFI_ENABLED=y
|
||||||
CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10
|
CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10
|
||||||
CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32
|
CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32
|
||||||
# CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set
|
CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y
|
||||||
CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y
|
CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=0
|
||||||
CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1
|
CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=16
|
||||||
CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32
|
CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=32
|
||||||
# CONFIG_ESP32_WIFI_CSI_ENABLED is not set
|
# CONFIG_ESP32_WIFI_CSI_ENABLED is not set
|
||||||
CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y
|
CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y
|
||||||
CONFIG_ESP32_WIFI_TX_BA_WIN=6
|
CONFIG_ESP32_WIFI_TX_BA_WIN=6
|
||||||
CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y
|
CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y
|
||||||
CONFIG_ESP32_WIFI_RX_BA_WIN=6
|
CONFIG_ESP32_WIFI_RX_BA_WIN=6
|
||||||
|
# CONFIG_ESP32_WIFI_AMSDU_TX_ENABLED is not set
|
||||||
CONFIG_ESP32_WIFI_NVS_ENABLED=y
|
CONFIG_ESP32_WIFI_NVS_ENABLED=y
|
||||||
CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y
|
CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y
|
||||||
# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set
|
# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set
|
||||||
|
@ -729,6 +787,7 @@ CONFIG_FATFS_LFN_NONE=y
|
||||||
CONFIG_FATFS_FS_LOCK=0
|
CONFIG_FATFS_FS_LOCK=0
|
||||||
CONFIG_FATFS_TIMEOUT_MS=10000
|
CONFIG_FATFS_TIMEOUT_MS=10000
|
||||||
CONFIG_FATFS_PER_FILE_CACHE=y
|
CONFIG_FATFS_PER_FILE_CACHE=y
|
||||||
|
CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y
|
||||||
# CONFIG_FATFS_USE_FASTSEEK is not set
|
# CONFIG_FATFS_USE_FASTSEEK is not set
|
||||||
# end of FAT Filesystem support
|
# end of FAT Filesystem support
|
||||||
|
|
||||||
|
@ -992,6 +1051,7 @@ CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y
|
||||||
# mbedTLS
|
# mbedTLS
|
||||||
#
|
#
|
||||||
CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||||
|
# CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC is not set
|
||||||
# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set
|
# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set
|
||||||
# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set
|
# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set
|
||||||
CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y
|
CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y
|
||||||
|
@ -1371,7 +1431,8 @@ CONFIG_STACK_CHECK_NONE=y
|
||||||
CONFIG_ESP32_APPTRACE_DEST_NONE=y
|
CONFIG_ESP32_APPTRACE_DEST_NONE=y
|
||||||
CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y
|
CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y
|
||||||
CONFIG_ADC2_DISABLE_DAC=y
|
CONFIG_ADC2_DISABLE_DAC=y
|
||||||
# CONFIG_SPIRAM_SUPPORT is not set
|
CONFIG_SPIRAM_SUPPORT=y
|
||||||
|
# CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is not set
|
||||||
CONFIG_TRACEMEM_RESERVE_DRAM=0x0
|
CONFIG_TRACEMEM_RESERVE_DRAM=0x0
|
||||||
# CONFIG_ULP_COPROC_ENABLED is not set
|
# CONFIG_ULP_COPROC_ENABLED is not set
|
||||||
CONFIG_ULP_COPROC_RESERVE_MEM=0
|
CONFIG_ULP_COPROC_RESERVE_MEM=0
|
||||||
|
@ -1400,7 +1461,6 @@ CONFIG_GDBSTUB_MAX_TASKS=32
|
||||||
# CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set
|
# CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set
|
||||||
CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y
|
CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y
|
||||||
CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4
|
CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4
|
||||||
CONFIG_ESP_SYSTEM_PD_FLASH=y
|
|
||||||
# CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND is not set
|
# CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND is not set
|
||||||
CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y
|
CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y
|
||||||
# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set
|
# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set
|
||||||
|
|
Loading…
Reference in a new issue