Created
October 22, 2020 20:48
-
-
Save jepler/0b5502df47c40e54f9d051567ae96ab8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ESP_ERROR_CHECK(twai_driver_install(&g_config, &t_config, &f_config)); | |
ESP_LOGI(EXAMPLE_TAG, "Driver installed"); | |
ESP_LOGI(EXAMPLE_TAG, "f_config.acceptance_code = 0x%08x\n", f_config.acceptance_code); | |
ESP_LOGI(EXAMPLE_TAG, "f_config.acceptance_mask = 0x%08x\n", f_config.acceptance_mask); | |
ESP_LOGI(EXAMPLE_TAG, "f_config.single_filter = 0x%08x\n", f_config.single_filter); | |
ESP_LOGI(EXAMPLE_TAG, "acceptance_filter.acr[] ="); | |
for(int i=0; i<4; i++) { | |
ESP_LOGI(EXAMPLE_TAG, " %02x", TWAI.acceptance_filter.acr[i].byte); | |
} | |
ESP_LOGI(EXAMPLE_TAG, "\n"); | |
ESP_LOGI(EXAMPLE_TAG, "acceptance_filter.amr[] ="); | |
for(int i=0; i<4; i++) { | |
ESP_LOGI(EXAMPLE_TAG, " %02x", TWAI.acceptance_filter.amr[i].byte); | |
} | |
ESP_LOGI(EXAMPLE_TAG, "\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
esp_err_t result = twai_driver_install(&self->g_config, &self->t_config, &self->f_config); | |
if (result == ESP_ERR_NO_MEM) { | |
mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); | |
} else if (result == ESP_ERR_INVALID_ARG) { | |
mp_raise_ValueError(translate("Invalid pins")); | |
} else if (result != ESP_OK) { | |
mp_raise_OSError_msg_varg(translate("twai_driver_install returned esp-idf error #%d"), (int)result); | |
} | |
mp_printf(&mp_plat_print, "f_config.acceptance_code = 0x%08x\n", self->f_config.acceptance_code); | |
mp_printf(&mp_plat_print, "f_config.acceptance_mask = 0x%08x\n", self->f_config.acceptance_mask); | |
mp_printf(&mp_plat_print, "f_config.single_filter = 0x%08x\n", self->f_config.single_filter); | |
mp_printf(&mp_plat_print, "acceptance_filter.acr[] ="); | |
for(int i=0; i<4; i++) { | |
mp_printf(&mp_plat_print, " %02x", TWAI.acceptance_filter.acr[i].byte); | |
} | |
mp_printf(&mp_plat_print, "\n"); | |
mp_printf(&mp_plat_print, "acceptance_filter.amr[] ="); | |
for(int i=0; i<4; i++) { | |
mp_printf(&mp_plat_print, " %02x", TWAI.acceptance_filter.amr[i].byte); | |
} | |
mp_printf(&mp_plat_print, "\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I (324) TWAI Self Test: Driver installed | |
I (324) TWAI Self Test: f_config.acceptance_code = 0xca000000 | |
I (334) TWAI Self Test: f_config.acceptance_mask = 0x01ffffff | |
I (334) TWAI Self Test: f_config.single_filter = 0x00000001 | |
I (344) TWAI Self Test: acceptance_filter.acr[] = | |
I (344) TWAI Self Test: ca | |
I (354) TWAI Self Test: 00 | |
I (354) TWAI Self Test: 00 | |
I (354) TWAI Self Test: 00 | |
I (364) TWAI Self Test: | |
I (364) TWAI Self Test: acceptance_filter.amr[] = | |
I (374) TWAI Self Test: 01 | |
I (374) TWAI Self Test: ff | |
I (374) TWAI Self Test: ff | |
I (384) TWAI Self Test: ff | |
I (384) TWAI Self Test: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f_config.acceptance_code = 0x00000000 | |
f_config.acceptance_mask = 0xffffffff | |
f_config.single_filter = 0x00000001 | |
acceptance_filter.acr[] = 5a 5a 5a 5a | |
acceptance_filter.amr[] = 5a 5a 5a 5a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment