Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full UART support for RPI #5676

Merged
merged 2 commits into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include "supervisor/shared/safe_mode.h"
#include "supervisor/shared/stack.h"
#include "supervisor/shared/status_leds.h"
#include "supervisor/shared/tick.h"
#include "supervisor/shared/traceback.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/workflow.h"
Expand Down
2 changes: 1 addition & 1 deletion ports/broadcom/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ $(BUILD)/firmware.disk.img.zip: $(BUILD)/kernel8.img
$(Q)parted -s $(BUILD)/circuitpython-disk.img mkpart primary fat32 0% 100%
$(Q)mkfs.fat -F 32 -n BOOT --offset=2048 $(BUILD)/circuitpython-disk.img

$(Q)mcopy -i $(BUILD)/circuitpython-disk.img@@1M config.txt firmware/bootcode.bin firmware/fixup* firmware/start* ::
$(Q)mcopy -i $(BUILD)/circuitpython-disk.img@@1M config.txt firmware/bootcode.bin firmware/fixup* firmware/start* firmware/*.dtb ::
$(Q)mcopy -i $(BUILD)/circuitpython-disk.img@@1M $(BUILD)/kernel8.img ::
$(Q)zip $@ $(BUILD)/circuitpython-disk.img
$(Q)rm $(BUILD)/circuitpython-disk.img
Expand Down
2 changes: 2 additions & 0 deletions ports/broadcom/boards/raspberrypi_cm4io/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2)

#define MICROPY_HW_LED_STATUS (&pin_GPIO42)
2 changes: 2 additions & 0 deletions ports/broadcom/boards/raspberrypi_cm4io/pins.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) },

{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO42) },

{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)},
};
Expand Down
2 changes: 2 additions & 0 deletions ports/broadcom/boards/raspberrypi_pi4b/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2)

#define MICROPY_HW_LED_STATUS (&pin_GPIO42)
2 changes: 1 addition & 1 deletion ports/broadcom/boards/raspberrypi_pi4b/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ USB_PID = 0xF001
USB_PRODUCT = "Raspberry Pi 4B"
USB_MANUFACTURER = "Raspberry Pi"

CHIP_VARIANT = bcm2711
CHIP_VARIANT = "bcm2711"
2 changes: 2 additions & 0 deletions ports/broadcom/boards/raspberrypi_pi4b/pins.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) },

{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO42) },

{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)},
};
Expand Down
3 changes: 2 additions & 1 deletion ports/broadcom/common-hal/busio/I2C.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
uint8_t sda_alt = 0;
for (scl_alt = 0; scl_alt < 6; scl_alt++) {
if (scl->functions[scl_alt].type != PIN_FUNCTION_I2C ||
i2c_in_use[scl->functions[scl_alt].index]) {
i2c_in_use[scl->functions[scl_alt].index] ||
scl->functions[scl_alt].function != I2C_FUNCTION_SCL) {
continue;
}
for (sda_alt = 0; sda_alt < 6; sda_alt++) {
Expand Down
Loading