-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
@RdaZhongyao, could you share the test results for all three compilers with this new target? |
Also, please take a look at the failing Travis CI results. |
There was a problem hiding this 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!
platform/mbed_lib.json
Outdated
@@ -42,6 +42,9 @@ | |||
}, | |||
"EFR32": { | |||
"stdio-baud-rate": 115200 | |||
}, | |||
"UNO_91H": { | |||
"stdio-baud-rate": 115200 |
There was a problem hiding this comment.
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..
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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!
targets/targets.json
Outdated
"detect_code": ["8002"] | ||
}, | ||
"UNO_91H": { | ||
"inherits": ["UNO_81C"], |
There was a problem hiding this comment.
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..
There was a problem hiding this comment.
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.
@hanno-arm @mazimkhan There's TRNG implementation , please review |
ARM Internal Ref: IOTSSL-2205 |
if(0U == obj->byte_idx) { | ||
int n; | ||
/* Delay for PRNG data ready */ | ||
for(n = 0; n < 4096; n++); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
@RdaZhongyao @0xc0170 @cmonr Could one of you provide access to a technical reference manual? |
@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 |
I don't have any docs I'm afraid.. |
@hanno-arm There's no public technical reference manual for now. If interested in the TRNG module, I can apply for it. |
@RdaZhongyao If possible, that would be very helpful - otherwise we can't review the TRNG code to a sufficient degree of confidence. |
There was a problem hiding this 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.
Thanks @RdaZhongyao for updating the waiting mechanism! Can you provide the reference manual for the TRNG? |
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)) | ||
{ |
There was a problem hiding this comment.
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);} |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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)
Going to get morph running. /morph build |
Build : FAILUREBuild number : 1866 |
@RdaZhongyao Please review the build logs for failures (this target fails to build for all 3 toolchains) |
/morph build |
Build : SUCCESSBuild number : 1934 Triggering tests/morph test |
Test : SUCCESSBuild number : 1756 |
Exporter Build : SUCCESSBuild number : 1580 |
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Closing this PR due to lack of activity. Feel free to reopen once updates are available. |
Let's reopen this PR. Our partner had some changes and new engineers are assigned to this. |
Build : FAILUREBuild number : 2385 |
@studavekar ^^^ Phantom build? |
Exporter Build : FAILUREBuild number : 2019 |
@studavekar ^^^ Phantom build. |
@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. |
@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. |
@RdaZhongyao Is work still being done on this PR, or was it migrated to #7309? |
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