Skip to content

Add RDA's new target UNO_81C #6508

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

Closed
wants to merge 2 commits into from
Closed

Conversation

RdaZhongyao
Copy link

@RdaZhongyao RdaZhongyao commented Mar 29, 2018

Description

New target UNO_81C from RDA Microelectronics.

Pull request type

[ ] Fix
[ ] Refactor
[x] New target
[ ] Feature
[ ] Breaking change

greentea logs are attached below:
c6cd6ef_GT_Log_ARMCC.txt
c6cd6ef_GT_Log_GCC.txt
c6cd6ef_GT_Log_IAR.txt

@cmonr
Copy link
Contributor

cmonr commented Apr 3, 2018

@RdaZhongyao, could you share the test results for all three compilers with this new target?

@cmonr
Copy link
Contributor

cmonr commented Apr 3, 2018

Also, please take a look at the failing Travis CI results.

@cmonr cmonr requested a review from 0xc0170 April 3, 2018 02:35
Copy link
Contributor

@ashok-rao ashok-rao left a comment

Choose a reason for hiding this comment

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

Some comments added..thanks!

@@ -42,6 +42,9 @@
},
"EFR32": {
"stdio-baud-rate": 115200
},
"UNO_91H": {
"stdio-baud-rate": 115200
Copy link
Contributor

Choose a reason for hiding this comment

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

Why default baud = 115200? Mbed OS default = 9600..

Copy link
Author

Choose a reason for hiding this comment

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

Baud 9600 is slow while testing, either 9600 or 115200 can be default.
Actually, the chip supports 1200 ~ 921600.

Copy link
Contributor

Choose a reason for hiding this comment

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

we are aware that it is slow, thus an app can overwrite, just that it has been defined as 9600 is default. The other 2 families are here because there are hw limitations and can do only 115200.


LED1 = GPIO_PIN21,
LED2 = GPIO_PIN1,

Copy link
Contributor

Choose a reason for hiding this comment

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

no user buttons or other analog input on the target?

Copy link
Author

Choose a reason for hiding this comment

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

The board contains 6 buttons, using only 1 ADC pin.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be useful to have atleast 1 button defined for user.


I2C_SCL = PC_0,
I2C_SDA = PC_1,

Copy link
Contributor

Choose a reason for hiding this comment

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

no SPI peripheral brought out?

Copy link
Author

Choose a reason for hiding this comment

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

1 SPI master supported, Arduino like pin layout provided on the board (D10~D13).

Copy link
Contributor

@ashok-rao ashok-rao Apr 4, 2018

Choose a reason for hiding this comment

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

In that case, you may want to define the Arduino pin maps also here (which I see is already done)..thanks!

"detect_code": ["8002"]
},
"UNO_91H": {
"inherits": ["UNO_81C"],
Copy link
Contributor

Choose a reason for hiding this comment

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

This should inherit from "RDA5981X" (parent target) rather than another derived target (UNO_81C).. this is required for Mbed 2 to build from online compiler.. I can see release_version above needs Mbed 2 as well..

Copy link
Author

Choose a reason for hiding this comment

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

RDA5981X chip series contain 81C/81AM/81A, they share the original name "91H". especially, 91H is an alias for 81C.
UNO_91H will be removed to meet the mbed 2 rules.

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 3, 2018

@hanno-arm @mazimkhan There's TRNG implementation , please review

@ciarmcom
Copy link
Member

ciarmcom commented Apr 3, 2018

ARM Internal Ref: IOTSSL-2205

@RdaZhongyao RdaZhongyao changed the title Add RDA's new target UNO_91H/UNO_81C Add RDA's new target UNO_81C Apr 4, 2018
if(0U == obj->byte_idx) {
int n;
/* Delay for PRNG data ready */
for(n = 0; n < 4096; n++);

Choose a reason for hiding this comment

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

This might be optimized away by the compiler, and even if it's not, it's not a reliable way to enforce a delay. Please clarify and quantify the need for a delay here and use an appropriate waiting mechanism.

Copy link
Author

Choose a reason for hiding this comment

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

The data rate generated by TRNG analog module is 1M(bps), so the TRNG_CTRL outputs 32-bit data in 1/32M(bps). There is no complete-flag or Interrupt mechanism, the delay should be implemented by software. How about using us_ticker_read()? @hanno-arm

Choose a reason for hiding this comment

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

@RdaZhongyao It is surprising to hear that the TRNG does neither support notification via interrupt nor via complete flag. If the only information available is the output rate, a static and reliable wait together with a check that the TRNG is in ordinary operation (if there's a register for that) seems to be the best option that remains. @mazimkhan @0xc0170 Ping.

Copy link
Contributor

Choose a reason for hiding this comment

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

us_ticker_read() would be better in this case than just a sw loop

@hanno-becker
Copy link

@RdaZhongyao @0xc0170 @cmonr Could one of you provide access to a technical reference manual?

@cmonr
Copy link
Contributor

cmonr commented Apr 4, 2018

@hanno-arm I wasn't able to find/source any documentation for these boards.

I suspect it will have to come from @RdaZhongyao or maybe @ashok-rao

@ashok-rao
Copy link
Contributor

I don't have any docs I'm afraid..

@RdaZhongyao
Copy link
Author

@hanno-arm There's no public technical reference manual for now. If interested in the TRNG module, I can apply for it.

@hanno-becker
Copy link

hanno-becker commented Apr 9, 2018

@RdaZhongyao If possible, that would be very helpful - otherwise we can't review the TRNG code to a sufficient degree of confidence.

Copy link

@hanno-becker hanno-becker left a comment

Choose a reason for hiding this comment

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

The waiting mechanism implemented in trng_get_byte in trng_api.c is not reliable and needs to be changed. Discussion is ongoing what the available and appropriate alternatives are. Apart from that, I couldn't perform a thorough review because the technical reference for the board in question is missing.

@hanno-becker
Copy link

Thanks @RdaZhongyao for updating the waiting mechanism! Can you provide the reference manual for the TRNG?

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

libhal - what version of toolchains were used to generate it? would it be good if that is documented in the Readme there in the folder where they are placed?

static unsigned char adc1_gp = 0U;
static int adc_inited_cnt = 0;

void analogin_init(analogin_t *obj, PinName pin) {
Copy link
Contributor

Choose a reason for hiding this comment

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

{ new line for function body, please correct in all HAL implementation files like this one

void analogin_free(analogin_t *obj) {
unsigned char gp = 6U;
adc_inited_cnt--;
if(0 == adc_inited_cnt) {
Copy link
Contributor

Choose a reason for hiding this comment

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

if () space between

if (!us_ticker_inited)
us_ticker_init();

#if DEVICE_SLEEP
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this related to ticker? Shall a comment be placed here?

UARTName uart_cts = (UARTName)pinmap_find_peripheral(txflow, PinMap_UART_CTS);

if ((UART_1 == uart_cts) && (NULL != uart1))
{
Copy link
Contributor

Choose a reason for hiding this comment

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

{ same line as the condition

#endif
}

void uart0_irq() {uart_irq((RDA_UART0->IIR & 0x0FUL), 0, (RDA_UART_TypeDef*)RDA_UART0);}
Copy link
Contributor

Choose a reason for hiding this comment

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

separate lines for the function call

void uart0..
{
    uart_irq();
}

(irq_handler[index])(uart_data[index].serial_irq_id, irq_type);

#if DEVICE_SLEEP
if((0 == index) && (RxIrq == irq_type) && (uart_data[index].rx_irq_set_api) && (NULL != uart_wakeup_handler)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

similar question to ticker, it might related to the driver used, that if sleep functionality is implemented, IRQ handler needs to to something ?

uint32_t delay_ticks = SystemCoreClock / LP_TIMER_CLOCK_SOURCE / 5;
if (delta <= 0) {
// This event was in the past:
lp_ticker_irq_handler();
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove this, its handled in the above. This also would lead to stack overflow (we have fire interrupt function to fire it asap)

@cmonr
Copy link
Contributor

cmonr commented Apr 27, 2018

Going to get morph running.

/morph build

@mbed-ci
Copy link

mbed-ci commented Apr 27, 2018

Build : FAILURE

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

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 27, 2018

@RdaZhongyao Please review the build logs for failures (this target fails to build for all 3 toolchains)

@cmonr
Copy link
Contributor

cmonr commented May 7, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented May 7, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented May 8, 2018

@mbed-ci
Copy link

mbed-ci commented May 8, 2018

@@ -0,0 +1,4 @@
libhal files in the subfolders are generated with toolchains:
* **Arm Compiler 5** - version 5.06u1
* **GNU Arm Embedded** - version 4.9.3
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be updated to gcc 6 ?

What actually is in this archive? SDK drivers?

Copy link
Contributor

Choose a reason for hiding this comment

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

Archive is mainly about sleep strategy.


int lp_ticker_soft_int_flag = 0;

#if DEVICE_SLEEP
Copy link
Contributor

Choose a reason for hiding this comment

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

From reading the code it is not clear why device sleep has impact on lp ticker or us ticker (I can see ifdef in the implementation)

Copy link
Contributor

Choose a reason for hiding this comment

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

If enter sleep mode, we will change clk source, so need conversion to calibration

lp_ticker_init();

/* Get timestamp from us_ticker */
return us_ticker_read();
Copy link
Contributor

Choose a reason for hiding this comment

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

lp ticker read = us ticker read?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes,we only have one timestamp, lp ticker and us ticker share it.

mbed_interface_disconnect();
#endif

#if defined(RDA_SLEEP_MODE)
Copy link
Contributor

Choose a reason for hiding this comment

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

what does RDA_SLEEP_MODE mean - is it defined? Where is it documented?

Copy link
Contributor

Choose a reason for hiding this comment

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

User can decide whether to allow sleep and set wakeup source (GPIO or UART) if RDA_SLEEP_MODE defined. We don't have public technical reference manual for now.

@cmonr
Copy link
Contributor

cmonr commented May 14, 2018

@RdaZhongyao ?

@cmonr
Copy link
Contributor

cmonr commented May 21, 2018

Closing this PR due to lack of activity. Feel free to reopen once updates are available.

@Ronny-Liu
Copy link
Contributor

Let's reopen this PR. Our partner had some changes and new engineers are assigned to this.

@cmonr cmonr reopened this Jun 19, 2018
@mbed-ci
Copy link

mbed-ci commented Jun 19, 2018

Build : FAILURE

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

@cmonr
Copy link
Contributor

cmonr commented Jun 19, 2018

@studavekar ^^^ Phantom build?

@mbed-ci
Copy link

mbed-ci commented Jun 19, 2018

@cmonr
Copy link
Contributor

cmonr commented Jun 19, 2018

@studavekar ^^^ Phantom build.

@Ronny-Liu
Copy link
Contributor

@cmonr Is that technically possible to allow kyliuxing edit directly on web UI? Since the original PR owner has left RDA and kyliuxing is now picking this up. If it is not possible then we should close this PR and create a new one.

@cmonr
Copy link
Contributor

cmonr commented Jun 22, 2018

@Ronny-Liu If it's not already possible, I would simply suggest closing this and opening a new PR. Just be sure to mention a link to the new PR here for tracking purposes.

@cmonr
Copy link
Contributor

cmonr commented Jun 28, 2018

@RdaZhongyao Is work still being done on this PR, or was it migrated to #7309?

@kyliuxing
Copy link
Contributor

@cmonr RdaZhongyao has left RDA, so please migrate it to #7309.

@0xc0170 0xc0170 closed this Jun 29, 2018
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.

9 participants