I get 502 error.
502 or 520 (like you typed on the subject line)? It’s just to make sure that you’re correctly identifying the error code.
Generally speaking, 520 errors are on the server side, i.e. not related to Cloudflare. Does your site work without Cloudflare enabled? (i.e. cache set to development mode, orange cloud thingy turned off in DNS)