Esp32-S3 : VERY IMPORTANT ! Use of the ULP Copro in order to receive or send datas on a Pin synchronously.
Posted: Thu Mar 30, 2023 8:19 am
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