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

boards: norik: Add support for Norik Octopus SoM & IO-Board #74523

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

FPlohl
Copy link

@FPlohl FPlohl commented Jun 19, 2024

Add support for Norik Octopus SoM & IO-Board. Octopus SoM is based on nRF9160, IO-board is "expander" PCB for the SoM.

Implemented fixes mentioned in boards: norik: Add support for Norik Octopus SoM & IO-Board #74239. That pull request was accidentally closed.

Building an application
=======================

In most case you'll need to use ``octopus_io_board_ns`` target for building examples.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name is not correct

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in recent changes

=======================

In most case you'll need to use ``octopus_io_board_ns`` target for building examples.
Some examples don't require non secure mode and can be built without ``octopus_io_board_ns`` target.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in recent changes

boards/norik/octopus_io_board/doc/index.rst Show resolved Hide resolved
Comment on lines 18 to 31
peripheral-power-controller {
compatible = "gpio-keys";

pwrgpio0: pwrgpio_0 {
label = "VP on/off";
gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>;
};

pwrgpio1: pwrgpio_1 {
label = "CHG control";
gpios = <&gpio0 20 (GPIO_ACTIVE_LOW)>;
};

};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are not buttons, a custom dts is needed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in recent changes

watchdog0 = &wdt0;
ldoctrl = &pwrgpio0;
chgctrl = &pwrgpio1;
bq25180 = &bq25180;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bq25180 is not used in samples, neither are ldoctrl or chgctrl

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in recent changes

pinctrl-names = "default", "sleep";

bq25180: bq25180@6a {
compatible = "i2c-device";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a driver is missing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in recent changes

bq25180: bq25180@6a {
compatible = "i2c-device";
status = "okay";
label = "BQ25180";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not use labels in peripherals

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in recent changes

Comment on lines 104 to 105
In most case you'll need to use ``octopus_som_ns`` target for building examples.
Some examples don't require non secure mode and can be built without ``octopus_som_ns`` target.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in recent changes

led0 = &led0;
pwm-led0 = &pwm_led0;
watchdog0 = &wdt0;
simselect = &sim_select;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in recent changes

@nordicjm
Copy link
Collaborator

@FPlohl tests are failing, can you fix?

int "Init priority"
default 99
help
Init priority for board control.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1x tab followed by 2x spaces for help text indent

}

return ret;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent

Comment on lines 18 to 38
static int octopus_som_sim_select(void)
{
const struct gpio_dt_spec simctrl = GPIO_DT_SPEC_GET(DT_PATH(sim_select), sim_gpios);

if (!gpio_is_ready_dt(&simctrl)) {
LOG_ERR("SIM select GPIO not available");
return -ENODEV;
}

if (DT_ENUM_IDX(SIM_SELECT_NODE, sim) == 0) {
(void)gpio_pin_configure_dt(&simctrl, GPIO_OUTPUT_LOW);
LOG_INF("On-board SIM selected");
} else {
(void)gpio_pin_configure_dt(&simctrl, GPIO_OUTPUT_HIGH);
LOG_INF("External SIM selected");
}
return 0;
}


static int octopus_som_init(void)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why these need to be 2 different functions


ret = octopus_som_sim_select();
if (ret < 0) {
LOG_ERR("Failed to select SIM, error %d", ret);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when this is just showing the same error as the other function

=======================

In most case you'll need to use ``octopus_som/nrf9160/ns`` target for building examples.
Some examples don't require non secure mode and can be built with ``octopus_som`` target.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*octopus_som/nrf9160


.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: octopus_som
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*octopus_som/nrf9160

int "Init priority"
default 99
help
Init priority for board control.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apply comments from other commit to this commit

Copy link
Collaborator

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply comments to both commits

Building an application
=======================

In most case you'll need to use ``octopus_som/nrf9160/ns`` target for building examples.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

board target

};
};

&flash0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is now all gone, see #76452

Copy link
Author

@FPlohl FPlohl Sep 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand what needs to be done here. Edit: nevermind, looked into recent commits

boards/norik/octopus_io_board/doc/index.rst Show resolved Hide resolved
@FPlohl
Copy link
Author

FPlohl commented Oct 1, 2024

@nordicjm twister tests seem to be canceled. Can you re-run them or give some insight why they failed?

@nordicjm
Copy link
Collaborator

nordicjm commented Oct 1, 2024

Compliance failure

@FPlohl FPlohl force-pushed the main branch 2 times, most recently from 5c43efb to defd842 Compare October 1, 2024 12:36
@FPlohl FPlohl requested a review from nordicjm October 3, 2024 06:22
Copy link
Collaborator

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits. then good

low-power-enable;
};
};

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change


config OCTOPUS_SOM_CONTROL_INIT_PRIORITY
int "Init priority"
default 99
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

select PINCTRL

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because you have a .c file which is using it. Breaks how? If it is a Kconfig error then add a new hidden Kconfig that selects that symbol

Copy link
Author

@FPlohl FPlohl Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added config BOARD_OCTOPUS_SOM that contains select PINCTRL. Now it works as expected.

Hardware
********

The Norik Octopus SoM supports the following hardware features:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Norik Octopus SoM supports the following hardware features:
The ``octopus_som/nrf9160`` and ``octopus_som/nrf9160/ns`` board targets support the following hardware features:

low-power-enable;
};
};

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change


config OCTOPUS_IO_BOARD_CONTROL_INIT_PRIORITY
int "Init priority"
default 99
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as per other comment

@FPlohl FPlohl force-pushed the main branch 2 times, most recently from 3cbce7a to b190fa0 Compare October 14, 2024 09:37
Comment on lines 43 to 35
const struct device *charger = DEVICE_DT_GET(CHARGER_NODE);

if (!device_is_ready(charger)) {
LOG_ERR("Charger not ready");
return -ENODEV;
}

const struct charger_config *cfg = charger->config;

ret = i2c_reg_update_byte_dt(&cfg->i2c, 0x5, 0xff, 0b00100100);

if (ret < 0) {
LOG_ERR("Failed to set charger CHARGECTRL0 register");
return ret;
}
LOG_INF("Set CHARGECTRL0 register");

return 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1, what is this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set input voltage treshold for on-board bq25180 charger. If not set, solar MPPT IC can't supply power efficiently.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be handled by the driver. device's config is not meant for public access.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, we can remove it. But I just want to point out that some other boards like Actinius boards use it to set some peripherals.

Copy link
Member

@gmarull gmarull Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some code gets in without proper reviews from time to time. that code is not accessing any driver internals nor changing a device state (eg i2c transfers) outside of its context.

return 0;
}

SYS_INIT(octopus_io_board_init, POST_KERNEL, CONFIG_OCTOPUS_IO_BOARD_CONTROL_INIT_PRIORITY);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use board hooks?

Comment on lines 4 to 8
description: |
This binding is used for controlling battery charger and
LDO regulator on the Octopus IO Board.
compatible: "norik,power-controller"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description, but since we did not supply a driver we'll be removing this for now.

Comment on lines 37 to 39
zephyr,code:
type: int
description: Key code to emit.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is input subsys stuff showing up here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed as above.

Comment on lines 18 to 31
peripheral-power-controller {
compatible = "norik,power-controller";

pwrgpio0: pwrgpio_0 {
label = "VP on/off";
gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>;
};

pwrgpio1: pwrgpio_1 {
label = "CHG control";
gpios = <&gpio0 20 (GPIO_ACTIVE_LOW)>;
};

};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like these are on/off switches? why not regulator-gpio?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.


# Enable GPIO
CONFIG_GPIO=y
CONFIG_INPUT_GPIO_KEYS=n
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidentally left in code, removed

CONFIG_UART_CONSOLE=y

# Enable charger
CONFIG_CHARGER=y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this required to eg boot hello world?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, removed

Add support for Norik Systems Octopus SoM based on nRF9160 SiP.

Supported features:
 - LTE-M/NB-IoT
 - GPS
 - LED
 - 3-axis accelerometer

Signed-off-by: Florijan Plohl <florijan.plohl@norik.com>
Add support for Norik Systems Octopus IO-Board based on
Norik Systems Octopus SoM.

Supported features:
 - LTE-M/NB-IoT
 - GPS
 - LED
 - 3-axis accelerometer
 - Battery charger
 - Solar charger
 - SPI NOR flash
 - Nano SIM connector

Signed-off-by: Florijan Plohl <florijan.plohl@norik.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants