Port manipulation Arduino Nano 33 BLE

Hi,

i would like to use direct port manipulation on the nano 33 BLE.

Background: I have several digitalWrite() within a timer callback function. This takes too much time and hence i need to speed up / optimise the code.

The commands PORTD or DDRD (see pic) seem to not work on the 33 BLE architecture. Is there any equivalent - i guess so!?

Thanks a lot!

You can have a look how it's done in Mbed OS:

That is the problem with low level code. It is not portable.

Can you tell us a bit more what your application is doing? That might give use some ideas how you can solve your issue.

Look at the data sheet (product specification) of the nRF52840 (available at Nordic). You can access the registers directly via pointers to the periphery modules (here GPIO). Because all ARM micro-controllers are rather similar, you can learn also from Arduino Due (SAM3x, Cortex M3) or Arduino Zero (SAMD21, Cortex M0).
There are different registers for setting and resetting pins. So you can use the same mask for setting/resetting a pin or a group of pins.
But you may get problems, if you use the mbed-OS (e.g. if you run the ArduinoBLE library).
Till now, I had no problems with direct nRF52840 access in loop() without the ArduinoBLE library. With the BLE library I detected delays up to 5 milliseconds.
Good luck.