Custom board PIO - philosophy

2021-05-30 Thread TimH

Hi all,

My custom board has a number of GPIOs that are related to more generic 
drivers. For example, the CAN implementation uses an arch. CAN driver 
appropriate for the processor, but has custom GPOs associated to 
enable/disable the CAN transceivers, and to enable/disable termination 
resistors.


Is the right/best method to extend the CAN driver with these - but 
perhaps #ifdef them so they only relate to this board (which may end up 
being submitted to the repositiry - haven't decided yet!) - or handle 
them in some other way?


I hope those with lots of experience of Nuttx can offer an opinion?

Thanks,

Tim.



Re: Custom board PIO - philosophy

2021-05-30 Thread Alan Carvalho de Assis
Hi Tim,

Normally an arch CAN driver doesn't have this enable pin or other similar
GPIO.

But if you plan to do it for your custom driver, it is better to use a
generic solution, like the CAN TX/RX pins do. Also UART, SPI and I2C uses
this solution.

Creating an #ifdef for each board inside your driver is not a good/right
solution.

You can use some GPIO_CANXYZ_EN_PIN in your driver and inside your board
you #define GPIO_CANXYZ_EN_PIN GPIO_PIN_Px

BR,

Alan

On Sunday, May 30, 2021, TimH  wrote:

> Hi all,
>
> My custom board has a number of GPIOs that are related to more generic
> drivers. For example, the CAN implementation uses an arch. CAN driver
> appropriate for the processor, but has custom GPOs associated to
> enable/disable the CAN transceivers, and to enable/disable termination
> resistors.
>
> Is the right/best method to extend the CAN driver with these - but perhaps
> #ifdef them so they only relate to this board (which may end up being
> submitted to the repositiry - haven't decided yet!) - or handle them in
> some other way?
>
> I hope those with lots of experience of Nuttx can offer an opinion?
>
> Thanks,
>
> Tim.
>
>


Re: Custom board PIO - philosophy

2021-05-30 Thread TimH

Thanks Alan,

I'd forgotten that there's a board-specific sam_mcan.c file (I'm so 
bogged down creating the correct arch. mcan driver for this processor; 
based on the one for the samv7)!


I will put my custom stuff in there. Obvious now you made me think about 
it :)


On 30/05/2021 11:42, Alan Carvalho de Assis wrote:

Hi Tim,

Normally an arch CAN driver doesn't have this enable pin or other similar
GPIO.

But if you plan to do it for your custom driver, it is better to use a
generic solution, like the CAN TX/RX pins do. Also UART, SPI and I2C uses
this solution.

Creating an #ifdef for each board inside your driver is not a good/right
solution.

You can use some GPIO_CANXYZ_EN_PIN in your driver and inside your board
you #define GPIO_CANXYZ_EN_PIN GPIO_PIN_Px

BR,

Alan

On Sunday, May 30, 2021, TimH  wrote:


Hi all,

My custom board has a number of GPIOs that are related to more generic
drivers. For example, the CAN implementation uses an arch. CAN driver
appropriate for the processor, but has custom GPOs associated to
enable/disable the CAN transceivers, and to enable/disable termination
resistors.

Is the right/best method to extend the CAN driver with these - but perhaps
#ifdef them so they only relate to this board (which may end up being
submitted to the repositiry - haven't decided yet!) - or handle them in
some other way?

I hope those with lots of experience of Nuttx can offer an opinion?

Thanks,

Tim.




--
JT Innovations Ltd., Unit 23 Tradecroft Industrial Estate, Wide Street, 
Portland, Dorset, DT5 2LN, UK Company number 7619086 VAT Registration GB 
111 7906 35


Re: Nimble on U-blox Nina B112 (Nrf52832)

2021-05-30 Thread Alan Carvalho de Assis
Hi Miguel,

the size text font in the image you sent is impossible to read.

I suggest you to select the text and post it here as raw text instead
attaching image.

BR,

Alan

On 5/29/21, Miguel Wisintainer  wrote:
> Some questions,
> I can see the nimble and i can execute, but freeze...must it to be execute
> with &
> I can see too the bnep0
> Wich app and sintax to test it ?
>
> [cid:image002.png@01D754A2.25216660]
> Enviado do Email para
> Windows 10
>
>


Re: Support for disk full detection using LittleFS

2021-05-30 Thread Xiang Xiao
On Fri, May 28, 2021 at 8:21 PM Flavio Castro Alves Filho <
flavio.al...@gmail.com> wrote:

> Hello,
>
> I am using LittleFS to store information on an external dataflash.
>
> I need to know if the memory is full. I saw that the nsh provides the
> df command, which as far as I understood is a cat for /proc/fs/usage
> file.
>
> In my code, I could see the LFS message indicating LFS_ERR_NOSPC,
> which is an error message indicating no more space when writing files.
> But the return from the fwrite call is OK (indicating the number of
> written bytes) :-|
>
>
This behaviour may be due to LittleFS not really committing the change to
disk until you call flush or close the file.


> Is /proc/fs/usage available for LittleFS? Is there any way to get the
> disk space programmatically?
>

You could call statfs and check f_bavail/f_bfree field:
https://github.com/apache/incubator-nuttx/blob/master/fs/littlefs/lfs_vfs.c#L1148-L1184


>
> Best regards,
>
> Flavio
>
> --
> Flavio de Castro Alves Filho
>
> flavio.al...@gmail.com
> Twitter: http://twitter.com/#!/fraviofii
> LinkedIn profile: www.linkedin.com/in/flaviocastroalves
>


Re: Support for disk full detection using LittleFS

2021-05-30 Thread Takashi Yamamoto
On Fri, May 28, 2021 at 9:21 PM Flavio Castro Alves Filho
 wrote:
>
> Hello,
>
> I am using LittleFS to store information on an external dataflash.
>
> I need to know if the memory is full. I saw that the nsh provides the
> df command, which as far as I understood is a cat for /proc/fs/usage
> file.
>
> In my code, I could see the LFS message indicating LFS_ERR_NOSPC,
> which is an error message indicating no more space when writing files.
> But the return from the fwrite call is OK (indicating the number of
> written bytes) :-|

if your FILE is buffered, you may just need fflush or fclose and check
the error.
in that case, it's an expected behavior.

otherwise, sounds like a bug in the OS.

>
> Is /proc/fs/usage available for LittleFS? Is there any way to get the
> disk space programmatically?
>
> Best regards,
>
> Flavio
>
> --
> Flavio de Castro Alves Filho
>
> flavio.al...@gmail.com
> Twitter: http://twitter.com/#!/fraviofii
> LinkedIn profile: www.linkedin.com/in/flaviocastroalves