Assuming you've already checked with your manager and there really is nothing on your plate, as a software engineer, the first thing that comes to mind is software improvements:
- fix or at least investigate bugs (if there are no bugs assigned to you, see if you can fix anything that has been bothering you)
- implement small wishlist features
- refactoring and code improvements
- increase test coverage (unit/integration tests)
- automate tedious tasks
It's very important that anything you pick up in your downtime needs to either be small or something you can put aside (e.g. commit to a separate branch) at a moment's notice.
Other than that, could you
- help/mentor any colleagues?
- do code reviews?
- write documentation? (I know you already mentioned that)
- read documentation/code of any subsystem you don't already know?
- read news/documentation about new technological developments
If there's still nothing to do, you could (as mentioned by @cdkMoose) learn a new programming language or technology that
- you know would be useful for your current job
- you think might be useful for your current job
- would be useful for your personal development
And of course it's okay to occasionally just enjoy the downtime because you know there will be times when you'll be stressed out of your mind.