You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@mynewt.apache.org by "Christopher Collins (JIRA)" <ji...@apache.org> on 2018/06/15 01:40:00 UTC

[jira] [Comment Edited] (MYNEWT-892) [NEWT/NORDIC] Transfer audio files from PC to Adafruit board, then sending via BLE

    [ https://issues.apache.org/jira/browse/MYNEWT-892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16513225#comment-16513225 ] 

Christopher Collins edited comment on MYNEWT-892 at 6/15/18 1:39 AM:
---------------------------------------------------------------------

Hi James,

First, 100kB is actually quite large for a device like the Adafruit Feather. Here are this hardware's memory specifications:
 * *Flash:* 512kB
 * *RAM:* 64kB

Depending on the actual size of the audio files, you will likely need to rearrange your BSP's flash map. This is briefly touched on [here|http://mynewt.apache.org/develop/os/core_os/porting/port_bsp.html#flash-map], but you may want to reach out on the [Mynewt slack channel|https://join.slack.com/mynewt/shared_invite/MTkwMTg1ODM1NTg5LTE0OTYxNzQ4NzQtZTU1YmNhYjhkMg] for help. Specifically, I imagine you will want to reduce the size of the {{FLASH_AREA_IMAGE_1}} flash area, and increase the area where the file system resides, {{FLASH_AREA_NFFS}}.

> 1) For transferring audio files from PC to the Adafruit, what are the available approaches ?

I think your best option is to use the [newtmgr|http://mynewt.apache.org/develop/newtmgr/index.html] tool. This tool is a client for a generic management protcol, called NMP, while your Mynewt device functions as an NMP server. Newtmgr can communicate over a variety of transports, including serial via a USB cable.

To upload the audio file, you would use the [fs|http://mynewt.apache.org/develop/newtmgr/command_list/newtmgr_fs.html] command, e.g.,
{noformat}
newtmgr --conntype serial --connstring /dev/ttyUSB0 fs upload /home/me/my-audio-file.pcm /dest-path.pcm
{noformat}
> Is there any way to use the same USB cable and still have UART port debugging normally?

Yes, the on-chip debugger multiplexes normal serial communication and debug commands through the same port. So you should be able to use the USB port normally while you are debugging.

> 2) I suppose it would stay in RAM by default, but is Ada RAM enough for the above size?

As indicated above, it is likely not enough. The {{newtmgr fs upload}} command writes directly to the file system in flash.

> 3) Can I send the file (in RAM) directly via BLE or I need to do somethings else before sending via BLE?

You can send the file directly via BLE. I imagine this would be done with a series of notification procedures using [ble_gattc_notify_custom()|http://mynewt.apache.org/latest/network/ble/ble_hs/ble_gattc/functions/ble_gattc_notify_custom/], but the particulars will depend on the software running on the phone. If the audio file is stored in the file system on the Mynewt device, you would use the various [file system functions|http://mynewt.apache.org/latest/os/modules/fs/fs/fs/] to access each chunk of the file sequentially.

That's a long response! Please feel free to follow up if it is unclear. As I mentioned, I think you'll get more informed and prompt replies in the Slack channel.


was (Author: ccollins476):
Hi James,

First, 100kB is actually quite large for a device like the Adafruit Feather.  Here are this hardware's memory specifications:
* *Flash:* 512kB
* *RAM:* 64kB
Depending on the actual size of the audio files, you will likely need to rearrange your BSP's flash map.  This is briefly touched on [here|http://mynewt.apache.org/develop/os/core_os/porting/port_bsp.html#flash-map], but you may want to reach out on the [Mynewt slack channel|https://join.slack.com/mynewt/shared_invite/MTkwMTg1ODM1NTg5LTE0OTYxNzQ4NzQtZTU1YmNhYjhkMg] for help.  Specifically, I imagine you will want to reduce the size of the {{FLASH_AREA_IMAGE_1}} flash area, and increase the area where the file system resides, {{FLASH_AREA_NFFS}}.

> 1) For transferring audio files from PC to the Adafruit, what are the available approaches ?

I think your best option is to use the [newtmgr|http://mynewt.apache.org/develop/newtmgr/index.html] tool.  This tool is a client for a generic management protcol, called NMP, while your Mynewt device functions as an NMP server.  Newtmgr can communicate over a variety of transports, including serial via a USB cable.  

To upload the audio file, you would use the [fs|http://mynewt.apache.org/develop/newtmgr/command_list/newtmgr_fs.html] command, e.g.,
{noformat}
newtmgr --conntype serial --connstring /dev/ttyUSB0 fs upload /home/me/my-audio-file.pcm /dest-path.pcm
{noformat}

> Is there any way to use the same USB cable and still have UART port debugging normally?

Yes, the on-chip debugger multiplexes normal serial communication and debug commands through the same port.  So you should be able to use the USB port normally while you are debugging.

> 2) I suppose it would stay in RAM by default, but is Ada RAM enough for the above size?

As indicated above, it is likely not enough.  The {{newtmgr fs upload}} command writes directly to the file system in flash.

> 3) Can I send the file (in RAM) directly via BLE or I need to do somethings else before sending via BLE?

You can send the file directly via BLE.  I imagine this would be done with a series of notification procedures using [ble_gattc_notify_custom()|http://mynewt.apache.org/latest/network/ble/ble_hs/ble_gattc/functions/ble_gattc_notify_custom/], but the particulars will depend on the software running on the phone.  If the audio file is stored in the file system on the Mynewt device, you would use the various [file system functions|http://mynewt.apache.org/latest/os/modules/fs/fs/fs/] to access each chunk of the file sequentially.

That's a long response!  Please feel free to follow up if it is unclear.  As I mentioned, I think you'll get more informed and prompt replies in the Slack channel.

> [NEWT/NORDIC] Transfer audio files from PC to Adafruit board, then sending via BLE
> ----------------------------------------------------------------------------------
>
>                 Key: MYNEWT-892
>                 URL: https://issues.apache.org/jira/browse/MYNEWT-892
>             Project: Mynewt
>          Issue Type: Wish
>      Security Level: Public(Viewable by anyone) 
>          Components: ble, Filesystem
>    Affects Versions: WISHLIST
>         Environment: PC: Window/Linux
> Phone: iOS/Android
>            Reporter: DINH LAM
>            Priority: Major
>              Labels: beginner, newbie
>
>  
> I am using an adafruit-nrf52-pro-feather (nrf52832) to run my project of detecting voice by this below scenario:
> ++ Setting up:
> [PC] ==== USB cable =====[Adafruit] * * * BLE * * * [Phone]
> + Audio files are very small size (less than 100kB or 20 seconds), with ADPCM format
> [http://www.kowatec.com/prod/ap/products.php?a=adpcm] 
> + USB cable which is delivered together with the board, but currently I am using as UART port for monitoring serial log.
>  
> I still have some concerns for this scenario as:
> 1) For transferring audio files from PC to the Adafruit, what are the available approaches ?
> Is there any way to use the same USB cable and still have UART port debugging normally?
> 2) I suppose it would stay in RAM by default, but is Ada RAM enough for the above size?
> 3) Can I send the file (in RAM) directly via BLE or I need to do somethings else before sending via BLE?
>  
> I appreciate any suggestions/helps or some reference links.
> Best Regards,
> James, Dinh



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)