TheThingsIndustries / generic-node-se

Generic Node Sensor Edition
https://www.genericnode.com
Other
109 stars 31 forks source link

[Future_Improvment] Increase I2C and SPI communication frequency #39

Closed elsalahy closed 3 years ago

elsalahy commented 4 years ago

Summary:

In the upcoming changes, we should consider increasing the serial bsuses communication frequency to ensure the node goes to sleep for longer periods and the sensor/flash commands are done faster.

Why do we need this?

To have a faster system and increase sleep time.

What is already there? What do you see now?

Slow frequency configurations.

What is missing? What do you want to see?

How do you propose to implement this?

Environment:

Baremetal.

Acceptance Criteria:

What can you do yourself and what do you need help with?

All

elsalahy commented 3 years ago

Please also allow for the following: 1- Configurable Frequency in the BSP Conf 2- Provide multiple frequency options as a comment (all options must be tested).

mcserved commented 3 years ago

@elsalahy I had a question about the I2C speed? How was SENESOR_I2C1_TIMING calculated exactly? https://github.com/TheThingsIndustries/generic-node-se/blob/e73e632008af8deb37c5635224992ba672222532/Software/lib/GNSE_BSP/GNSE_bsp_serial.h#L75 My logic analyser reads that the SCL pin has a frequency of 142kHz (7us from rise to rise).

elsalahy commented 3 years ago

@marnixcrouzen This was part of the STM32WL package, and there is a chance it can be incorrect/inaccurate.

Please analyze the value as part of the issue and explain your finding if you consider this to be incorrect.

mcserved commented 3 years ago

Previous version had the following comment, but was deemed too confusing since the I2C speeds are altered by both the I2C setting and the clockspeed.

/ Fast Mode Plus /

define I2C_SPEED_FMP_50_KHZ 0x20003EFD

define I2C_SPEED_FMP_100_KHZ 0x20003D5E

define I2C_SPEED_FMP_200_KHZ 0x20000348

define I2C_SPEED_FMP_300_KHZ 0x0020088D // Secure element will not work above this speed

define I2C_SPEED_FMP_500_KHZ 0x00201441

define I2C_SPEED_FMP_1_MHZ 0x20000209

/ Fast Mode /

define I2C_SPEED_FM_50_KHZ 0x20103EFD

define I2C_SPEED_FM_100_KHZ 0x20103D5E

define I2C_SPEED_FM_200_KHZ 0x20100843

define I2C_SPEED_FM_300_KHZ 0x0040187D

/ Standard Speed /

define I2C_SPEED_STD_50_KHZ 0x20303EFD

define I2C_SPEED_STD_100_KHZ 0x20303E5D