Skip to content

add support for the RAK811 #6043

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

Merged
merged 6 commits into from
Mar 30, 2018
Merged

add support for the RAK811 #6043

merged 6 commits into from
Mar 30, 2018

Conversation

ithinuel
Copy link
Member

@ithinuel ithinuel commented Feb 8, 2018

Description

This adds support for the lora module RAK811.

This has been tested with our beloved blinky flashed with openocd.

Todo

  • Update python scripts to run tests

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
// SYSCLK = 32 MHz ((16 MHz * 4) / 2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HSI calibration value is missing. Add:
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;


ANT_CTX_PA = PA_4,
ANT_CRX_RX = PB_6,
ANT_CBT_HF = PB_7,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ANT_CBT_HF a lora pin? Instead Lora needs:
RF_TCXO_EN = PH_1,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have CBT_HF from : https://github.com/RAKWireless/RAK811_BreakBoard/blob/1d5483aef2c691640db747fb230ceeb96acb378b/src/boards/RAK811BreakBoard/board.h#L96
However I have no idea about what those pins are as I don't know (yet) lora at all.

@kivaisan
Copy link
Contributor

This is now ok for our lora example application.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 19, 2018

NEED WORK

What does need work for this pull request?

@ithinuel
Copy link
Member Author

As stated in the Todo list Update python scripts to run tests at least unless it's not mandatory.

@ithinuel
Copy link
Member Author

Also @jeromecoutant are the modifications to spi_api.c and hal_tick_16b.c ok ?

Copy link
Collaborator

@jeromecoutant jeromecoutant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of pins are missing in the PeripheralPins.c file ?

@@ -59,7 +59,9 @@ int spi_get_clock_freq(spi_t *obj) {
spi_hz = HAL_RCC_GetPCLK2Freq();
break;
case SPI_2:
case SPI_3:
#ifdef SPI_3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no SPI_3 in STM32L151CB

@ithinuel
Copy link
Member Author

@jeromecoutant that's because I only exposed the "usable" peripheral depending on what's actually wired in and out the module.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 21, 2018

As stated in the Todo list Update python scripts to run tests at least unless it's not mandatory.

When will be these added? Is it travis CI addition, any other?

@cmonr
Copy link
Contributor

cmonr commented Feb 27, 2018

@ithinuel?

@ithinuel
Copy link
Member Author

ithinuel commented Mar 5, 2018

Sorry for the delay,
@0xc0170 : Indeed they all seem to be related to CI tests.
@cmonr @0xc0170 : I can't work on this anymore, I have to hand it over.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 12, 2018

Looking at the additions here. What we are missing are tests results.

@kivaisan Can you run tests for all 3 toolchains? or @ithinuel who could help

@kivaisan
Copy link
Contributor

Here are the results with the latest mbed-os. Some problems with GCC and ARMCC

test_report_armcc.txt
test_report_gcc.txt
test_report_iar.txt

@adbridge
Copy link
Contributor

@ashok-rao Are the PE team now taking responsibility for this port ??

@ashok-rao
Copy link
Contributor

@adbridge .. sorry for late reply..this is still in discussion.. Will update as soon as I can. Thanks.

@ithinuel
Copy link
Member Author

@ARMmbed/team-st-mcd

Could you please check the FLASHSIZE_BASE value as it reports 0x6280 on my platform ?

@bcostm
Copy link
Contributor

bcostm commented Mar 26, 2018

The FLASHSIZE_BASE defined in the stm32l151xb.h file is correct:
#define FLASHSIZE_BASE ((uint32_t)0x1FF8004CU)

I have no idea why you have 0x6280 on your platform ?

@ithinuel
Copy link
Member Author

@bcostm The only thing I know is that I have a STM32L151CBU6A and that I read with gdb :

(gdb) p (uint32_t)(*((uint16_t *)((uint32_t)0x1FF8004C)) * 1024)
$1 = 25821184

because :

(gdb) p /x *((uint16_t *)((uint32_t)0x1FF8004C))
$2 = 0x6280

@ithinuel
Copy link
Member Author

ithinuel commented Mar 26, 2018

My device ID is 0x10386429 which describes a Cat.2 device where only the LSB represents the Flash size, hence the 0x6280 being invalid.

However the HAL only provides a way to read 16bit.

And according to the reference manual, the HAL is probably also wrong for the devices where devid=0x436.

@bcostm
Copy link
Contributor

bcostm commented Mar 26, 2018

I looked in the stm32l1xx_ll_utils.h file and there is a note in the LL_GetFlashSize function:

@note For DEV_ID = 0x429, only LSB part of F_SIZE: F_SIZE[7:0] is valid. The MSB part
F_SIZE[15:8] is reserved and must be ignored.

So I suppose your device is a 0x429 (last digits). The size is only on the 8 first bits and you read 0x6280
--> 0x80 = 128KB

@ithinuel
Copy link
Member Author

I base my research on what STM32Cube has generated but it seems that the stm_hal in mbed is outdated compared to what STM32Cube "generates".

@ARMmbed/team-st-mcd How would you fix that issue ?

I'll try to backport the difference between stm32l151xb.h and stm32l151xba.h to our current version.

@ithinuel
Copy link
Member Author

@bcostm Indeed, also uint32_t flash_get_size(const flash_t *obj) from flash_api.c directly uses FLASH_SIZE.

@bcostm
Copy link
Contributor

bcostm commented Mar 26, 2018

it seems that the stm_hal in mbed is outdated compared to what STM32Cube "generates".

The update of the STM32L1 HAL driver in mbed is in our plan. We should do it in the coming weeks.

@ithinuel
Copy link
Member Author

ithinuel commented Mar 27, 2018

"Fixing" this issue raised another one in multithreaded access to the NVStore.
I disable the FLASH feature for now. If anyone needs this, they may need to address that issue first.

test_report_armc6.txt
test_report_gcc.txt
All tests pass

@mbed-ci
Copy link

mbed-ci commented Mar 27, 2018

Build : FAILURE

Build number : 1585
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6043/

@ithinuel
Copy link
Member Author

@cmonr What kind of failure is that ?

@cmonr
Copy link
Contributor

cmonr commented Mar 27, 2018

That is a completely new type of CI failure. Don't think it's PR related.

@studavekar
Copy link
Contributor

studavekar commented Mar 27, 2018

@cmonr What kind of failure is that ?

From logs looks like support for IAR toolchian is missing

Traceback (most recent call last):
  File "/builds/ws/mbed-os-pipeline/tools/make.py", line 191, in <module>
    print(mcu_toolchain_matrix(platform_filter=options.general_filter_regex))
  File "/builds/ws/mbed-os-pipeline/tools/build_api.py", line 1264, in mcu_toolchain_matrix
    version_release_targets[version] = get_mbed_official_release(version)
  File "/builds/ws/mbed-os-pipeline/tools/build_api.py", line 288, in get_mbed_official_release
    raise InvalidReleaseTargetException(reason)
tools.utils.InvalidReleaseTargetException: Target 'MTB_RAK811' must support ALL of the folowing toolchains to be included in the mbed OS 5.0 official release: ARM, GCC_ARM, IAR
Currently it is only configured to support the following toolchains: ARM, GCC_ARM

@cmonr
Copy link
Contributor

cmonr commented Mar 27, 2018

@ithinuel Looks like I spoke too soon. The build job failed before actually building anything.

The CI expects GCC_ARM, ARM, and IAR to be all supported toolchains.

@studavekar
Copy link
Contributor

@ithinuel Looks like I spoke too soon. The build job failed before actually building anything.

The CI expects GCC_ARM, ARM, and IAR to be all supported toolchains.

@cmonr Is it mbed-os requirements to support all 3 toolchain ?

@ithinuel
Copy link
Member Author

@cmonr @studavekar a lot of platform does not support all 3, non-exhaustive list :

  • SSCI824
  • LPC4337
  • TEENSY3_1
  • MTS_GAMBIT
  • DISCO_F401VC

@studavekar
Copy link
Contributor

@cmonr @studavekar a lot of platform does not support all 3, non-exhaustive list :

SSCI824
LPC4337
TEENSY3_1
MTS_GAMBIT
DISCO_F401VC

Doesn't look like it shows up in the supported list. Or am I missing something?

➜  mbed-os git:(mbed-os-5.8.0-rc2) ✗ mbed target --supported | grep -i 'LPC4337\|SSCI824\|TEENSY3_1\|MTS_GAMBIT\|DISCO_F401VC\|K22f\|K64F'
| K22F                 | Supported | Supported | Supported | Supported | Supported | Supported |
| K64F                 | Supported | Supported | Supported | Supported | Supported | Supported |

@ashok-rao
Copy link
Contributor

https://www.mbed.com/en/about-mbed/mbed-enabled/mbed-enabled-program-requirements/ .. all 3 toolchains MUST be supported for Mbed Enabled..

@ithinuel
Copy link
Member Author

@ashok-rao Thank you, i'll add IAR then.

@studavekar they are in targets/targets.json

@cmonr
Copy link
Contributor

cmonr commented Mar 28, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 28, 2018

Build : SUCCESS

Build number : 1603
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6043/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Mar 28, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 28, 2018

@bcostm
Copy link
Contributor

bcostm commented Mar 28, 2018

Just a note concerning:

DISCO_F401VC
Doesn't look like it shows up in the supported list. Or am I missing something?

Only the GCC_ARM compiler is supported on this board because this board is not mbed enabled (you can see that the "release_versions" property in targets.json is not present). This explains why.

@ithinuel
Copy link
Member Author

@bcostm Thanks ! I still have things to learn about targets.json :P

@cmonr
Copy link
Contributor

cmonr commented Mar 28, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 28, 2018

Build : SUCCESS

Build number : 1622
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6043/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Mar 28, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 29, 2018

Test : SUCCESS

Build number : 1404
Test logs :http://mbed-os-logs.s3-website-us-west-1.amazonaws.com/?prefix=logs/6043/1404

Copy link
Contributor

@cmonr cmonr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

{
if (SetSysClock_PLL_HSI() == 0) {
while(1) {
// [TODO] Put something here to tell the user that a problem occured...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I look forward to the day where this line is replaced on the other STM devices along with this.

@cmonr cmonr merged commit c8bd08f into ARMmbed:master Mar 30, 2018
@ithinuel ithinuel deleted the add-rak811 branch March 30, 2018 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.