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

add support for the RAK811 #6043

Merged
merged 6 commits into from Mar 30, 2018

Conversation

Projects
None yet
@ithinuel
Member

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

@ithinuel ithinuel force-pushed the ithinuel:add-rak811 branch from 18ef4b2 to c7b15b1 Feb 8, 2018

@cmonr cmonr added the needs: work label Feb 9, 2018

@ithinuel ithinuel force-pushed the ithinuel:add-rak811 branch 2 times, most recently from b84c057 to b72e061 Feb 12, 2018

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)

This comment has been minimized.

@kivaisan

kivaisan Feb 15, 2018

Contributor

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,

This comment has been minimized.

@kivaisan

kivaisan Feb 15, 2018

Contributor

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

This comment has been minimized.

@ithinuel

ithinuel Feb 19, 2018

Member

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

This comment has been minimized.

Contributor

kivaisan commented Feb 19, 2018

This is now ok for our lora example application.

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Feb 19, 2018

NEED WORK

What does need work for this pull request?

@ithinuel

This comment has been minimized.

Member

ithinuel commented Feb 19, 2018

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

@ithinuel

This comment has been minimized.

Member

ithinuel commented Feb 19, 2018

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

@jeromecoutant

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

This comment has been minimized.

@jeromecoutant

jeromecoutant Feb 19, 2018

Contributor

There is no SPI_3 in STM32L151CB

@ithinuel

This comment has been minimized.

Member

ithinuel commented Feb 19, 2018

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

@0xc0170

This comment has been minimized.

Member

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

This comment has been minimized.

Contributor

cmonr commented Feb 27, 2018

@ithinuel

This comment has been minimized.

Member

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

This comment has been minimized.

Member

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

This comment has been minimized.

Contributor

kivaisan commented Mar 13, 2018

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

This comment has been minimized.

Contributor

adbridge commented Mar 21, 2018

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

@ashok-rao

This comment has been minimized.

Contributor

ashok-rao commented Mar 23, 2018

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

@ithinuel

This comment has been minimized.

Member

ithinuel commented Mar 23, 2018

@ARMmbed/team-st-mcd

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

@bcostm

This comment has been minimized.

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

This comment has been minimized.

Member

ithinuel commented Mar 26, 2018

@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

This comment has been minimized.

Member

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

This comment has been minimized.

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

This comment has been minimized.

Member

ithinuel commented Mar 26, 2018

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

This comment has been minimized.

Member

ithinuel commented Mar 26, 2018

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

@bcostm

This comment has been minimized.

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.

@cmonr

This comment has been minimized.

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

This comment has been minimized.

Collaborator

studavekar 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.

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

@ithinuel

This comment has been minimized.

Member

ithinuel commented Mar 27, 2018

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

  • SSCI824
  • LPC4337
  • TEENSY3_1
  • MTS_GAMBIT
  • DISCO_F401VC
@studavekar

This comment has been minimized.

Collaborator

studavekar commented Mar 27, 2018

@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

This comment has been minimized.

Contributor

ashok-rao commented Mar 27, 2018

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

@ithinuel

This comment has been minimized.

Member

ithinuel commented Mar 27, 2018

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

@studavekar they are in targets/targets.json

@cmonr

This comment has been minimized.

Contributor

cmonr commented Mar 28, 2018

/morph build

@mbed-ci

This comment has been minimized.

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

@ithinuel ithinuel force-pushed the ithinuel:add-rak811 branch from 751d5a7 to 1edba63 Mar 28, 2018

@ithinuel ithinuel force-pushed the ithinuel:add-rak811 branch from 1edba63 to 85af9f9 Mar 28, 2018

@mbed-ci

This comment has been minimized.

@ithinuel ithinuel force-pushed the ithinuel:add-rak811 branch from 4b7b73c to 85af9f9 Mar 28, 2018

@mbed-ci

This comment has been minimized.

@bcostm

This comment has been minimized.

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

This comment has been minimized.

Member

ithinuel commented Mar 28, 2018

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

@cmonr

This comment has been minimized.

Contributor

cmonr commented Mar 28, 2018

/morph build

@mbed-ci

This comment has been minimized.

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

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@cmonr

cmonr approved these changes Mar 30, 2018

LGTM

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

This comment has been minimized.

@cmonr

cmonr Mar 30, 2018

Contributor

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

11 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 10249 cycles (+1229 cycles)
Details
travis-ci/littlefs Passed, code size is 10092B (+0.00%)
Details
travis-ci/tools Local tools testing has passed
Details

@ithinuel ithinuel deleted the ithinuel:add-rak811 branch Mar 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment