Esp32-S3 : VERY IMPORTANT ! Use of the ULP Copro in order to receive or send datas on a Pin synchronously.
-
- Posts: 229
- Joined: Thu Jul 14, 2022 5:15 am
Esp32-S3 : VERY IMPORTANT ! Use of the ULP Copro in order to receive or send datas on a Pin synchronously.
Good afternoon,
I am using an Esp32-S3 microcontroller and I need to implement the following feature :
"An external component provides a 4000Hz Clk (250uS period) on a CLK_PIN of the Esp32-S3 and depending
on its mode, the Esp32-S3 must have the possibility to send or receive datas on/from a a DATA_PIN (On CLK_PIN edges).
The Esp32-S3 behaviour must be the following :
1) In RxMode : The Esp32-S3 must receive datas from the DATA_PIN when the CLK_PIN goes High.
2) In TxMode : The Esp32-S3 must send datas on the DATA_PIN when the CLK_PIN goes Low."
This is typically what a SPI Receiver can do. However, I have no free SPI in my application.
I am looking for another way to implement this function.
Because the Clock period is very low (250 us), I don't want to do this using interrupts on the CLK_PIN of the Esp32-S3
(Because this would disturb the behaviour of my application too much).
I have seen in the reference manual that an ULP-RISC-V ULP Coprocessor exists in the chip.
Do you think that this function could be realized by this coprocessor and how ?
I have few questions concerning the ULP-RISC-V ULP Coprocessor :
1) Is it possible to exchange info between the CPU0 or CPU1 (Main_Appli) and the ULP Copro so that the Copro can know
that the "Main_Appli" is in RxMode or TxMode ?
2) Can the Copro be configured to generate an interrupt on the CLK_PIN with a 250us period ?
3) If yes, I have seen that interrupts can only be level interrupts and not edge interrupts. Do you think that using level interrupts on
the CLK_PIN, I can implement the following feature ?
4) If yes, do you think it is possible to change the level on the interrupt (LOW or HIGH) depending on the main appli (On CPU0 and CPU1 side) mode (Rx/Tx).
5) Do you think it is possible to record the samples that are on the DATA_PIN in RxMode and put some samples on the DATA_PIN in TxMode in the CLK_PIN interrupt handler ?
I see that the ULP-RISC-V ULP Coprocessor has a Monitor mode. I wish I could use this mode in order to implement the feature. However, I also see that there are HALT and RUN periods in this mode. So :
1) Can the Copro deal with interrupts in HALT Mode or only in RUN Mode ?
2) If the answer is No, is it possible to always put the Copro into RUN Mode ? Or is it possible to set the HALT Mode very short ?
Another question, the goal in RxMode is to detect a special pattern on the DATA_PIN.
If the pattern is detected on the Copro side (Using the above principle), is it possible to send a signal or to set a variable
on the main_application (Running on CPU0 and CPU1 side ?).
Thank you for your help on the subject.
This is really important.
Best regards,
Thomas TRUILHE
I am using an Esp32-S3 microcontroller and I need to implement the following feature :
"An external component provides a 4000Hz Clk (250uS period) on a CLK_PIN of the Esp32-S3 and depending
on its mode, the Esp32-S3 must have the possibility to send or receive datas on/from a a DATA_PIN (On CLK_PIN edges).
The Esp32-S3 behaviour must be the following :
1) In RxMode : The Esp32-S3 must receive datas from the DATA_PIN when the CLK_PIN goes High.
2) In TxMode : The Esp32-S3 must send datas on the DATA_PIN when the CLK_PIN goes Low."
This is typically what a SPI Receiver can do. However, I have no free SPI in my application.
I am looking for another way to implement this function.
Because the Clock period is very low (250 us), I don't want to do this using interrupts on the CLK_PIN of the Esp32-S3
(Because this would disturb the behaviour of my application too much).
I have seen in the reference manual that an ULP-RISC-V ULP Coprocessor exists in the chip.
Do you think that this function could be realized by this coprocessor and how ?
I have few questions concerning the ULP-RISC-V ULP Coprocessor :
1) Is it possible to exchange info between the CPU0 or CPU1 (Main_Appli) and the ULP Copro so that the Copro can know
that the "Main_Appli" is in RxMode or TxMode ?
2) Can the Copro be configured to generate an interrupt on the CLK_PIN with a 250us period ?
3) If yes, I have seen that interrupts can only be level interrupts and not edge interrupts. Do you think that using level interrupts on
the CLK_PIN, I can implement the following feature ?
4) If yes, do you think it is possible to change the level on the interrupt (LOW or HIGH) depending on the main appli (On CPU0 and CPU1 side) mode (Rx/Tx).
5) Do you think it is possible to record the samples that are on the DATA_PIN in RxMode and put some samples on the DATA_PIN in TxMode in the CLK_PIN interrupt handler ?
I see that the ULP-RISC-V ULP Coprocessor has a Monitor mode. I wish I could use this mode in order to implement the feature. However, I also see that there are HALT and RUN periods in this mode. So :
1) Can the Copro deal with interrupts in HALT Mode or only in RUN Mode ?
2) If the answer is No, is it possible to always put the Copro into RUN Mode ? Or is it possible to set the HALT Mode very short ?
Another question, the goal in RxMode is to detect a special pattern on the DATA_PIN.
If the pattern is detected on the Copro side (Using the above principle), is it possible to send a signal or to set a variable
on the main_application (Running on CPU0 and CPU1 side ?).
Thank you for your help on the subject.
This is really important.
Best regards,
Thomas TRUILHE
-
- Posts: 229
- Joined: Thu Jul 14, 2022 5:15 am
Re: Esp32-S3 : VERY IMPORTANT ! Use of the ULP Copro in order to receive or send datas on a Pin synchronously.
I would like to say "I have seen that a Normal Mode exists in the ULP Copro" instead of "I have seen that a Monitor Mode exists in the ULP Copro" sorry.
-
- Posts: 229
- Joined: Thu Jul 14, 2022 5:15 am
Re: Esp32-S3 : VERY IMPORTANT ! Use of the ULP Copro in order to receive or send datas on a Pin synchronously.
Maybe I have misunderstood something...
Do you think that in normal mode, the ULP Copro is always running and there is no HALT and RUN periods ?
Do you think that in normal mode, the ULP Copro is always running and there is no HALT and RUN periods ?
Re: Esp32-S3 : VERY IMPORTANT ! Use of the ULP Copro in order to receive or send datas on a Pin synchronously.
My understanding is that the ULP does not support the SPI peripheral, at least not via an API.
I doubt that it would be able to access the SPI peripherals via memory mapped IO, but even if it could, you said all the SPI's are already in use.
This would mean that you would need to bitbang SPI.
If you're bit-banging SPI anyway, why no just do it on the main, fast processor than the one optimized for ultra low power consumption?
> 1) Is it possible to exchange info between the CPU0 or CPU1 (Main_Appli) and the ULP Copro so that the Copro can know
> that the "Main_Appli" is in RxMode or TxMode ?
Yes, it's a bit involved because you have to define common variables in the linker script, I believe. The IDF documentationhttps://docs.espressif.com/projects/esp ... isc-v.html has some details you may want to familiarize yourself with.
> 2) 3) 4) Interrupt questions ...
I'm a little confused by your elaboration: why would you want to generate interrupts from the ULP when the clock pin changes? Why not just use the ESP's native interrupts?
I think you may be mistaken about the general purpose of the ULP. It's not a "coprocessor" in the sense that it's a third core to offload work onto. It's meant to perform minimal processing/monitoring tasks while the main cores are sleeping.
Minor Nitpick: Your title would be improved if you omit the "VERY IMPORTANT!". Apart from the all caps being annoying, it doesn't add much value, because, well, this is very important only to you
I doubt that it would be able to access the SPI peripherals via memory mapped IO, but even if it could, you said all the SPI's are already in use.
This would mean that you would need to bitbang SPI.
If you're bit-banging SPI anyway, why no just do it on the main, fast processor than the one optimized for ultra low power consumption?
> 1) Is it possible to exchange info between the CPU0 or CPU1 (Main_Appli) and the ULP Copro so that the Copro can know
> that the "Main_Appli" is in RxMode or TxMode ?
Yes, it's a bit involved because you have to define common variables in the linker script, I believe. The IDF documentationhttps://docs.espressif.com/projects/esp ... isc-v.html has some details you may want to familiarize yourself with.
> 2) 3) 4) Interrupt questions ...
I'm a little confused by your elaboration: why would you want to generate interrupts from the ULP when the clock pin changes? Why not just use the ESP's native interrupts?
I think you may be mistaken about the general purpose of the ULP. It's not a "coprocessor" in the sense that it's a third core to offload work onto. It's meant to perform minimal processing/monitoring tasks while the main cores are sleeping.
Minor Nitpick: Your title would be improved if you omit the "VERY IMPORTANT!". Apart from the all caps being annoying, it doesn't add much value, because, well, this is very important only to you
-
- Posts: 229
- Joined: Thu Jul 14, 2022 5:15 am
Re: Esp32-S3 : VERY IMPORTANT ! Use of the ULP Copro in order to receive or send datas on a Pin synchronously.
Thank you for your answer.
So you mean that it is not possible to use the RISC-V ULP Copro as an extra code and do
processing while the other cores are running ? Even in normal mode ?
Best regards,
Thomas TRUILHE
So you mean that it is not possible to use the RISC-V ULP Copro as an extra code and do
processing while the other cores are running ? Even in normal mode ?
Best regards,
Thomas TRUILHE
Re: Esp32-S3 : VERY IMPORTANT ! Use of the ULP Copro in order to receive or send datas on a Pin synchronously.
No I mean the ULP is not a third core for additional processing power or more IO peripherals. It's a minimal subsystem intended to allow selected (trivial) tasks to be executed while the main cores sleep.So you mean that it is not possible to use the RISC-V ULP Copro as an extra code and do
processing while the other cores are running ? Even in normal mode ?
If you look at the documentation I linked to, there does not seem to be any indication that both core types can't be running simultaneously. It just wouldn't make sense to run them simultaneously because anything that can be done on the ULP can be achieved easier and more efficiently on the application cores.
-
- Posts: 229
- Joined: Thu Jul 14, 2022 5:15 am
Re: Esp32-S3 : VERY IMPORTANT ! Use of the ULP Copro in order to receive or send datas on a Pin synchronously.
Ok,
but here, my idea was to do interrupt on input PIN using the ULP Copro instead of doing this on the CPU0 or 1.
Of course the CPU0 or 1 can do interrupt function but this would disturb the processes running on my program.
So I just would like to do interrupt process on the ULP Copro while the CPU0 and 1 are running.
Do you think it is possible and how ?
Best regards
but here, my idea was to do interrupt on input PIN using the ULP Copro instead of doing this on the CPU0 or 1.
Of course the CPU0 or 1 can do interrupt function but this would disturb the processes running on my program.
So I just would like to do interrupt process on the ULP Copro while the CPU0 and 1 are running.
Do you think it is possible and how ?
Best regards
-
- Posts: 1731
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Esp32-S3 : VERY IMPORTANT ! Use of the ULP Copro in order to receive or send datas on a Pin synchronously.
This should definitely be possible. Even the FSM-ULP could do it; polling for a clock edge and then either read a bit from IO or write a bit to IO and send one interrupt to the main CPU after n (8? 16? 32?) bits have been transferred.
Not too far away from https://github.com/espressif/esp-idf/tr ... lp_fsm/ulp
Not too far away from https://github.com/espressif/esp-idf/tr ... lp_fsm/ulp
-
- Posts: 229
- Joined: Thu Jul 14, 2022 5:15 am
Re: Esp32-S3 : VERY IMPORTANT ! Use of the ULP Copro in order to receive or send datas on a Pin synchronously.
Very good news !!!
I would like to try it on the RISC-V Coprocessor.
Do you know how to write program on this ULP copro ?
Are there examples or something like that ??
Best regards,
I would like to try it on the RISC-V Coprocessor.
Do you know how to write program on this ULP copro ?
Are there examples or something like that ??
Best regards,
Re: Esp32-S3 : VERY IMPORTANT ! Use of the ULP Copro in order to receive or send datas on a Pin synchronously.
Have you had a look at the documentation? https://docs.espressif.com/projects/esp ... -v-program
Who is online
Users browsing this forum: Google [Bot] and 174 guests