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

Make sure the peripherals are controllable with Zephyr #112

Closed
3 of 4 tasks
ikerperezdelpalomar opened this issue Jan 15, 2021 · 5 comments
Closed
3 of 4 tasks

Make sure the peripherals are controllable with Zephyr #112

ikerperezdelpalomar opened this issue Jan 15, 2021 · 5 comments
Labels
firmware Relating to the device firmware Zepher Port to real timeOS

Comments

@ikerperezdelpalomar
Copy link

ikerperezdelpalomar commented Jan 15, 2021

  • Add support for turning LEDs on/off
  • Add USB support
    • Test usb support in Zephyr
  • Make sure spi can be used.

Work happening in: https://github.com/CodethinkLabs/bloodlight-firmware/tree/ikerperez/zephyr-board-porting

@ikerperezdelpalomar ikerperezdelpalomar mentioned this issue Jan 15, 2021
6 tasks
@tlsa tlsa added firmware Relating to the device firmware Zepher Port to real timeOS labels Jan 26, 2021
@ikerperezdelpalomar ikerperezdelpalomar changed the title Make sure the gpios are controllable with Zephyr Make sure the peripherials are controllable with Zephyr Feb 15, 2021
@ikerperezdelpalomar ikerperezdelpalomar changed the title Make sure the peripherials are controllable with Zephyr Make sure the peripherals are controllable with Zephyr Feb 15, 2021
@ikerperezdelpalomar
Copy link
Author

Currently it's possible to use USB as STOUD, this can be proven by running the zephyr/samples/subsys/usb/console test.

However when trying to run a more basic test (such as zephyr/samples/helloworld) were devicetree APIs are not used to configure and enable USB like in the example above the laptop doesn't detect the bloodlight board, which makes me think that USB has not been enabled.

Next steps have to be:

  1. Discover why this happens.
  2. When the reason is discovered:
    1. If this happens because the DPPU bit in USB_BCDR register is not raised, sort it out. (Follow the steps described in the issue description.)
    2. If it's for a different reason evaluate if it is worth to work on it or if it is more worth to use the devicetreet APIs

In order to write a value to the register HAL_PCD_DevConnect might help.

The next might be helpful:

Taken from stm32cube/stm32g4xx

@ikerperezdelpalomar
Copy link
Author

Answer to point 1 on previous comment:

Sample hello_world does not use USB and so not enables it, and if hello_world would enable USB it would not be a simplest sample and thus not hello_world. There are few boards which enables USB on board level per default because this boards do not have a debug probe integrated and so depends on USB for logging or shell.

@ikerperezdelpalomar
Copy link
Author

I used zephyr/samples/susbsys/usb/console to test the usb configuration. This way i found out that Zephyr expects the app to enable usb and not the usb driver, so this should be handled by us in the firmware. To enable usb usb_enable() must be used. Some notes about this:

Zephyr Release Notes 2.2

USB
The usb_enable() function, which was previously invoked automatically by the USB stack, now needs to be explicitly called by the application in order to enable the USB subsystem.
The usb_enable() function now takes a parameter, usb_dc_status_callback which can be set by the application to a callback to receive status events from the USB stack. The parameter can also be set to NULL if no callback is required.

[0]

Zephyr Release Notes 2.4

USB
The usb_enable() function, which, for some samples, was invoked automatically on system boot up, now needs to be explicitly called by the application in order to enable the USB subsystem. If your application relies on any of the following Kconfig options, then it shall also enable the USB subsystem:
:option:CONFIG_USB_DEVICE_NETWORK_ECM
:option:CONFIG_USB_DEVICE_NETWORK_EEM
:option:CONFIG_USB_DEVICE_NETWORK_RNDIS
:option:CONFIG_TRACING_BACKEND_USB
:option:CONFIG_USB_UART_CONSOLE

[1]

@ikerperezdelpalomar
Copy link
Author

This issue will be discussed in CodethinkLabs/bloodlight-zephyr#4 in the future

@tlsa
Copy link
Collaborator

tlsa commented Apr 26, 2021

@tlsa tlsa closed this as completed Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
firmware Relating to the device firmware Zepher Port to real timeOS
Projects
None yet
Development

No branches or pull requests

2 participants