Re: HW configuration of Nimble (HCI)

2016-11-23 Thread Christopher Collins
Hi Oleg,

On Wed, Nov 23, 2016 at 03:07:11PM +0300, Oleg Persidskiy wrote:
> good time dear Engineers!
> 
> Have a question about your newt Nimble (HCI) subproject.
> (sorry I'm a newbie with newt ~ 1 day)

Great!

> During the test (I use nRF52 own board) faced with a problem , where I can
> reconfigure
> PORT IO pins, SPEED & etc. parameters ?
> 
> nRF5x SoC has very flexible PIO configuration ability but I cannot set my
> board paratemetrs to Nimble HCI driver (it default uses nRF52DK based board
> configuration).
> 
> Summary I need to
> 1. decrease the HCI_UART speed to 19200 (long line capacity issue)
> 2. remap IO pins Numbers: RX/TX/CTS/RTS according to my board.
> 3. change Protocol 8 bit to 9 bit (w parity)

This is one area of Mynewt that could definitely use some better
documentation.  To adjust these settings, you need to use the syscfg
mechanism.  In short, each package defines system-wide settings via
something called syscfg.  Your project can then override the default
values of these settings in various packages, usually the app or target.
For simplicity, I would recommend overriding these settings at the
target level for now.

Here is how you would override these settings.  Note: For the following,
I am assuming you are using the nRF52dk BSP.  If you are not, the
following will still probably work, but you may want to adjust the
comments accordingly.

* Create a file called "syscfg.yml" in your target directory
  (targets//syscfg.yml)

* Add the following contents to this file:

syscfg.vals:
# @apache-mynewt-core/hw/bsp/nrf52dk
UART_0_PIN_TX:  
UART_0_PIN_RX:  
UART_0_PIN_RTS: 
UART_0_PIN_CTS: 

# @apache-mynewt-core/net/nimble/transport/uart
BLE_HCI_UART_BAUD:  19200
BLE_HCI_UART_DATA_BITS: 9
BLE_HCI_UART_STOP_BITS: (*)
BLE_HCI_UART_PARITY:(**)

Replace pin-num values as appropriate.

I wasn't sure which values are appropriate for stop bits or parity.
Valid parity values are:
HAL_UART_PARITY_NONE,
HAL_UART_PARITY_ODD,
HAL_UART_PARITY_EVEN,

This file will reconfigure your project as specified.  You can see a
list of all the settings in your project with the "newt target config
" command.  The settings are organized by their defining
package.  As indicated by the comments above, the settings in this case
come from the nrf52dk BSP package and the nimble UART transport package.

> 
> 
> Thanks you a lot!
> 
> Oleg.


Re: Nimble HCI

2016-03-24 Thread Christopher Collins
On Wed, Mar 23, 2016 at 05:08:37PM -0700, will sanfilippo wrote:
[...]

To summarize my understanding of your proposal (please let me know if I
got anything wrong!):

1. Create several independent HCI packages in the net/nimble directory.

>   net/nimble/hci_spi
>   net/nimble/hci_combined
>   net/nimble/hci_uart

2. Each HCI package exports the "ble_hci" API in its pkg.yml.

# net/nimble/hci_spi/pkg.yml
pkg.apis: ble_hci

3. Both net/nimble/host and net/nimble/controller require the "ble"hci"
API in their pkg.yml files.

# net/nimble/host/pkg.yml
pkg.req_apis: ble_hci

4. The app specifies the hard dependency on a specific HCI package.

# apps/myapp/pkg.yml
pkg.deps: @apache-mynewt-core/net/nimble/hci_spi

I like it.  There is one annoyance, though: it is too bad that the app
has to depend on a specific HCI package.  Using bletiny as an example,
it would be nice if this app could be HCI-transport-agnostic.  However,
some piece of code has to initialize the specific HCI package being
used, and it makes sense that this would happen in the app, so I am not
sure this is an issue.  It might be worthwhile to think a bit about how
we might solve this issue cleanly.  The only solutions I can think of
add too much complexity to justify, in my opinion.

Thanks,
Chris