ambiot / ambpro2_arduino

AmebaPro2 Arduino third-party package SDK
https://www.amebaiot.com/en/ameba-arduino-summary/
MIT License
45 stars 20 forks source link

GPIO port writing. #231

Closed boburshokirov closed 3 months ago

boburshokirov commented 4 months ago

Hardware Environment

AMB82-MINI

Related technical area

GPIO port writing.

Is the feature request related to an un-fixed issue?

No.

Describe the ideal solution/reault/output.

I am trying to connect a TFT display with 8-bit parallel interface. It is working perfectly when I write with digitalWrite(). But the speed is slow. I found a function to write to a GPIO port. But I couldn't make it work. Can you please provide an instructions to use that function?

Additional remarks

No response

I have checked existing/closed list of issues and the Contributing Guide.

github-actions[bot] commented 4 months ago

Hello, hope this message finds you well. Congrats to your first Issue! We will review it as soon as possiable. Feel free to have a look at https://www.amebaiot.com/en/ameba-arduino-summary/ for more information

Kyderio commented 4 months ago

Hi @boburshokirov,

Sorry for the late reply, it may be true that the GPIO speed may not be able to send data fast enough to a TFT display. Can I check what TFT LCD are you using and is there an SPI interface where you can use instead?

Thank you.

boburshokirov commented 4 months ago

Hi @Kyderio ,

Thanks for the reply. I already tried a couple of other TFT displays with SPI interface. But they are slower than TFT with GPIO. I tried 8-bit parallel writing into the port with other Microcontrollers and it works much faster. I can see micros to write into a port in your library. But I couldn't make it work. If you can provide a simple example of writing into a port, that would be great.

Thanks in advance.

Kyderio commented 4 months ago

Hi @boburshokirov,

You may refer to the file "wiring_digital.c". There is an API called digitalWrite(uint32_t ulPin, uint32_t ulVal). You may use this API to write into a port. There are many examples in the SDK that uses this API. You may refer to "GPIO->examples->MeasureDistance_HCSR04_Ultrasonic.ino" for reference on how to use this API to write into the port.

Hope this helps.

Thanks.

boburshokirov commented 4 months ago

Hi @Kyderio ,

As I mentioned, I want to write into 8 pins at one time. Above example is for writing into 1 pin. digitalWrite(uint32_t ulPin, uint32_t ulVal) is for writing 1 pin, right? If not, can you please provide an example to write into 8 pins at one time.

Thanks

Kyderio commented 4 months ago

Hi @boburshokirov,

Unfortunately it is not possible at the moment for GPIO 8 bit parallel write. You may consider I2C interface or SPI interface. There will be a delay for writing 8 bits at once with GPIO interface.

Hope this helps.

Thanks.

M-ichae-l commented 3 months ago

closed as no further discussion.