I’m very interested in using the RTOS core together with the Linux one. To get started, I downloaded the image v1.1.1, flashed in on an SD card and I followed the instructions on this page to build and run the mailbox_test application.
So I built the application, sent it to the board and it would fail with this error : open failed! fd = -1.
I also renamed the blink.sh file so that the LED does not blink anymore when the system starts.
According to the code, it failed while trying to open /dev/cvi-rtos-cmdqu which indeed did not exist. So I guess the kernel is not built with the mailbox driver enabled.
So I added CONFIG_CVI_MAILBOX=y in build/boards/cv181x/cv1813h_milkv_duos_sd/linux/cvitek_cv1813h_milkv_duos_sd_defconfig, build the image, flash it on my SD card aaand it mostly works:
[root@milkv-duo]~# ./mailbox_test
RT: [43.048849]prvQueueISR
RT: [43.051192]recv cmd(19) from C906B, param_ptr [0x00000002]
RT: [43.056926]recv cmd(19) from C906B...send [0x00000004] to C906B
C906B: cmd.param_ptr = 0x4
RT: [47.063961]prvQueueISR
RT: [47.066304]recv cmd(19) from C906B, param_ptr [0x00000003]
RT: [47.072038]recv cmd(19) from C906B...send [0x00000004] to C906B
C906B: cmd.param_ptr = 0x3
Except that the blue led does not turn ON and OFF .
Just tested it with the latest image I had lying around (built it recently from an old arduino branch before they rebased it on top of current develop branch): the mailbox example works on my Duo 64M. Are you using a Duo S, btw?
Now, after rebuilding the whole image (yes, both U-Boot, FreeRTOS firmware, and everything) against current develop branch and placing it onto a TF card, and testing it with the mailbox example, I can confirm:
It is working now and it was working a while ago. Unfortunately, there might be something on your end which prevents it from working right.
UPD0: It must be Duo S you’re using, I tested the Duo S image, and it doesn’t have the CMDQU driver, and probably its FreeRTOS firmware doesn’t have the counterpart as well. Now building the V2 image (RISC-V for Duo S) to test.
UPD1: Haha, yes indeed. And you mentioned this didn’t help. Therefore, there might be something else.
UPD2: Tested the duo-buildroot-sdk-v2, it does have the cvi-rtos-cmdqu driver, but it is apparently missing the libwiringx.so component, which is used in the mailbox example.
Thanks for your answer and for testing the demo on your end!
You’re right, I forgot to mention I’m using the duo-s board.
So yes, the kernel is not built with support for the mailbox feature, but it’s quite easy to rebuild it with the optiok enabled.
Then, the mailbox app seems to work fine (the logs from the Linux and RT cores are the same than the ones in the documentation) except that the LED does not turn on and off.
Maybe this test program was built to run on the duo (not - s) and that some changes must be applied to run on the duo-s (like the pin number, for example)?
I’ll try to figure the pin mapping out and see if I can make it to work!
I’m still interested to know if someone managed to run it on the duo-s as well
According to the doc, the blue LED is connected to XGPIOA[29].
According to the pin mapping, XPGIOA is located at address 0x03020000
Then the changes are pretty straightforward:
Edit the value of GPIO2 in freertos/cvitek/task/comm/src/riscv64/milkv_duo_io.h from 0x03022000 to 0x03020000
Edit the file freertos/cvitek/task/comm/src/riscv64/milkv_duo_io.c to change the value 24 to 29.
If you haven’t done it before, don’t forget to enable the mailbox driver in the kernel : Add CONFIG_CVI_MAILBOX=y at the end of build/boards/cv181x/cv1813h_milkv_duos_sd/linux/cvitek_cv1813h_milkv_duos_sd_defconfig
Flash the image on the SD card, build the mailbox_test app, send it to the board, run it, and the LED will simply turn ON and then OFF