Waveshare 3.5inch LCD RPI modelA on RPI3B+ for Volumio

I greet you all
This is my first post on this forum.
If at the beginning I didn’t know anything about debian from this forum I learned something.
My problem is that I cannot rotate a display 180 degrees.
I use a raspberry pi 3 B and a display MPI3501 driver ILI9486 with touchscreen and Volumio-3.661-2024-04-24-pi
The touchscreen works rotated 180 degrees, but the display does not.
I attach :

config.txt
userconfig.txt
Xorg.0.log
99-calibration.conf
99-fbturbo.conf

config.txt

### DO NOT EDIT THIS FILE ###
### APPLY CUSTOM PARAMETERS TO userconfig.txt ###
initramfs volumio.initrd
gpu_mem=128
gpu_mem_256=32
gpu_mem_512=32
gpu_mem_1024=128
max_usb_current=1
[pi5]
usb_max_current_enable=1
[all]
include volumioconfig.txt
include userconfig.txt

userconfig.txt
# Add your custom config.txt options to this file, which will be preserved during updates

dtparam=spi=on
dtoverlay=waveshare35a

hdmi_force_hotplug=1
max_usb_current=1
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 480 320 60 6 0 0 0
hdmi_drive=2
display_rotate=0

#### Touch Display rotation setting below: do not alter ####
display_lcd_rotate=2
display_hdmi_rotate=2

Xorg.0.log

[    50.354] 
X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
[    50.354] Build Operating System: Linux 5.4.0-109-generic armv8l Raspbian
[    50.354] Current Operating System: Linux tity-rpi3 6.1.69-v7+ #1710 SMP Thu Dec 21 13:14:13 GMT 2023 armv7l
[    50.354] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_headphones=0 snd_bcm2835.enable_headphones=1 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=480 bcm2708_fb.fbheight=320 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  splash plymouth.ignore-serial-consoles dwc_otg.fiq_enable=1 dwc_otg.fiq_fsm_enable=1 dwc_otg.fiq_fsm_mask=0xF dwc_otg.nak_holdoff=1 quiet console=ttyS0,115200 console=tty1 imgpart=/dev/mmcblk0p2 imgfile=/volumio_current.sqsh rootwait bootdelay=5 elevator=noop logo.nologo vt.global_cursor_default=0 net.ifnames=0 snd-bcm2835.enable_compat_alsa= snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 loglevel=0
[    50.354] Build Date: 04 April 2023  07:50:56AM
[    50.354] xorg-server 2:1.20.4-1+rpt4+deb10u9 (https://www.debian.org/support) 
[    50.354] Current version of pixman: 0.36.0
[    50.354] 	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
[    50.354] Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    50.355] (==) Log file: "/var/log/Xorg.0.log", Time: Wed May 29 11:41:07 2024
[    50.366] (==) Using config directory: "/etc/X11/xorg.conf.d"
[    50.366] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[    50.374] (==) No Layout section.  Using the first Screen section.
[    50.374] (==) No screen section available. Using defaults.
[    50.374] (**) |-->Screen "Default Screen Section" (0)
[    50.374] (**) |   |-->Monitor "<default monitor>"
[    50.381] (==) No device specified for screen "Default Screen Section".
	Using the first device section listed.
[    50.381] (**) |   |-->Device "Allwinner A10/A13 FBDEV"
[    50.381] (==) No monitor specified for screen "Default Screen Section".
	Using a default monitor configuration.
[    50.381] (==) Automatically adding devices
[    50.381] (==) Automatically enabling devices
[    50.381] (==) Automatically adding GPU devices
[    50.381] (==) Max clients allowed: 256, resource mask: 0x1fffff
[    50.382] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[    50.382] 	Entry deleted from font path.
[    50.384] (==) FontPath set to:
	/usr/share/fonts/X11/misc,
	/usr/share/fonts/X11/100dpi/:unscaled,
	/usr/share/fonts/X11/75dpi/:unscaled,
	/usr/share/fonts/X11/Type1,
	/usr/share/fonts/X11/100dpi,
	/usr/share/fonts/X11/75dpi,
	built-ins
[    50.384] (==) ModulePath set to "/usr/lib/xorg/modules"
[    50.384] (II) The server relies on udev to provide the list of input devices.
	If no devices become available, reconfigure udev or disable AutoAddDevices.
[    50.384] (II) Loader magic: 0x1fdf80
[    50.384] (II) Module ABI versions:
[    50.384] 	X.Org ANSI C Emulation: 0.4
[    50.384] 	X.Org Video Driver: 24.0
[    50.384] 	X.Org XInput driver : 24.1
[    50.384] 	X.Org Server Extension : 10.0
[    50.387] (--) using VT number 2

[    50.387] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[    50.387] (II) no primary bus or device found
[    50.387] (II) LoadModule: "glx"
[    50.391] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[    50.441] (II) Module glx: vendor="X.Org Foundation"
[    50.441] 	compiled for 1.20.4, module version = 1.0.0
[    50.441] 	ABI class: X.Org Server Extension, version 10.0
[    50.441] (II) LoadModule: "fbturbo"
[    50.441] (II) Loading /usr/lib/xorg/modules/drivers/fbturbo_drv.so
[    50.445] (II) Module fbturbo: vendor="X.Org Foundation"
[    50.445] 	compiled for 1.20.3, module version = 0.5.1
[    50.445] 	Module class: X.Org Video Driver
[    50.445] 	ABI class: X.Org Video Driver, version 24.0
[    50.445] (II) FBTURBO: driver for framebuffer: fbturbo
[    50.447] (WW) Falling back to old probe method for fbturbo
[    50.447] (II) Loading sub module "fbdevhw"
[    50.447] (II) LoadModule: "fbdevhw"
[    50.447] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
[    50.450] (II) Module fbdevhw: vendor="X.Org Foundation"
[    50.450] 	compiled for 1.20.4, module version = 0.0.2
[    50.450] 	ABI class: X.Org Video Driver, version 24.0
[    50.450] (II) FBTURBO(0): using /dev/fb1
[    50.450] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[    50.450] (II) FBTURBO(0): Creating default Display subsection in Screen section
	"Default Screen Section" for depth/fbbpp 16/16
[    50.450] (==) FBTURBO(0): Depth 16, (==) framebuffer bpp 16
[    50.450] (==) FBTURBO(0): RGB weight 565
[    50.450] (==) FBTURBO(0): Default visual is TrueColor
[    50.450] (==) FBTURBO(0): Using gamma correction (1.0, 1.0, 1.0)
[    50.450] (II) FBTURBO(0): hardware: fb_ili9486 (video memory: 300kB)
[    50.450] (DB) xf86MergeOutputClassOptions unsupported bus type 0
[    50.450] (**) FBTURBO(0): Option "fbdev" "/dev/fb1"
[    50.450] (**) FBTURBO(0): Option "SwapbuffersWait" "true"
[    50.451] (II) FBTURBO(0): processor: Unknown
[    50.451] (II) FBTURBO(0): checking modes against framebuffer device...
[    50.451] (II) FBTURBO(0): checking modes against monitor...
[    50.451] (II) FBTURBO(0): Virtual size is 480x320 (pitch 480)
[    50.451] (**) FBTURBO(0):  Built-in mode "current"
[    50.451] (==) FBTURBO(0): DPI set to (96, 96)
[    50.451] (II) Loading sub module "fb"
[    50.451] (II) LoadModule: "fb"
[    50.451] (II) Loading /usr/lib/xorg/modules/libfb.so
[    50.456] (II) Module fb: vendor="X.Org Foundation"
[    50.456] 	compiled for 1.20.4, module version = 1.0.0
[    50.456] 	ABI class: X.Org ANSI C Emulation, version 0.4
[    50.457] (II) FBTURBO(0): FBIOBLANK: Invalid argument (Screen blanking not supported by kernel - disabling)
[    50.475] (II) FBTURBO(0): using backing store heuristics
[    50.487] (II) FBTURBO(0): can't load 'g2d_23' kernel module
[    50.487] (II) FBTURBO(0): failed to enable the use of sunxi display controller
[    50.487] (II) FBTURBO(0): No sunxi-g2d hardware detected (check /dev/disp and /dev/g2d)
[    50.487] (II) FBTURBO(0): G2D hardware acceleration can't be enabled
[    50.487] (II) FBTURBO(0): enabled VFP/NEON optimizations
[    50.487] (==) FBTURBO(0): Backing store enabled
[    50.495] (==) FBTURBO(0): DPMS enabled
[    50.495] (II) FBTURBO(0): failed to enable hardware cursor
[    50.495] (II) FBTURBO(0): no 3D acceleration because the driver has been compiled without libUMP
[    50.495] (II) FBTURBO(0): if this is wrong and needs to be fixed, please check ./configure log
[    50.496] (II) Initializing extension Generic Event Extension
[    50.497] (II) Initializing extension SHAPE
[    50.498] (II) Initializing extension MIT-SHM
[    50.499] (II) Initializing extension XInputExtension
[    50.504] (II) Initializing extension XTEST
[    50.505] (II) Initializing extension BIG-REQUESTS
[    50.506] (II) Initializing extension SYNC
[    50.507] (II) Initializing extension XKEYBOARD
[    50.508] (II) Initializing extension XC-MISC
[    50.509] (II) Initializing extension SECURITY
[    50.510] (II) Initializing extension XFIXES
[    50.511] (II) Initializing extension RENDER
[    50.512] (II) Initializing extension RANDR
[    50.514] (II) Initializing extension COMPOSITE
[    50.516] (II) Initializing extension DAMAGE
[    50.517] (II) Initializing extension MIT-SCREEN-SAVER
[    50.517] (II) Initializing extension DOUBLE-BUFFER
[    50.518] (II) Initializing extension RECORD
[    50.519] (II) Initializing extension DPMS
[    50.520] (II) Initializing extension Present
[    50.521] (II) Initializing extension DRI3
[    50.521] (II) Initializing extension X-Resource
[    50.522] (II) Initializing extension XVideo
[    50.523] (II) Initializing extension XVideo-MotionCompensation
[    50.523] (II) Initializing extension SELinux
[    50.523] (II) SELinux: Disabled on system
[    50.523] (II) Initializing extension GLX
[    50.524] (II) AIGLX: Screen 0 is not DRI2 capable
[    51.762] (II) IGLX: Loaded and initialized swrast
[    51.762] (II) GLX: Initialized DRISWRAST GL provider for screen 0
[    51.762] (II) Initializing extension XFree86-VidModeExtension
[    51.763] (II) Initializing extension XFree86-DGA
[    51.764] (II) Initializing extension XFree86-DRI
[    51.767] (II) Initializing extension DRI2
[    52.058] (II) config/udev: Adding input device ADS7846 Touchscreen (/dev/input/event4)
[    52.058] (**) ADS7846 Touchscreen: Applying InputClass "evdev touchscreen catchall"
[    52.058] (**) ADS7846 Touchscreen: Applying InputClass "libinput touchscreen catchall"
[    52.058] (**) ADS7846 Touchscreen: Applying InputClass "calibration"
[    52.058] (**) ADS7846 Touchscreen: Applying InputClass "Touch rotation"
[    52.058] (**) ADS7846 Touchscreen: Applying InputClass "calibration"
[    52.058] (II) LoadModule: "evdev"
[    52.059] (II) Loading /usr/lib/xorg/modules/input/evdev_drv.so
[    52.065] (II) Module evdev: vendor="X.Org Foundation"
[    52.065] 	compiled for 1.20.3, module version = 2.10.6
[    52.065] 	Module class: X.Org XInput Driver
[    52.065] 	ABI class: X.Org XInput driver, version 24.1
[    52.065] (II) Using input driver 'evdev' for 'ADS7846 Touchscreen'
[    52.065] (**) ADS7846 Touchscreen: always reports core events
[    52.065] (**) evdev: ADS7846 Touchscreen: Device: "/dev/input/event4"
[    52.065] (--) evdev: ADS7846 Touchscreen: Vendor 0 Product 0x1ea6
[    52.065] (--) evdev: ADS7846 Touchscreen: Found absolute axes
[    52.065] (--) evdev: ADS7846 Touchscreen: Found x and y absolute axes
[    52.065] (--) evdev: ADS7846 Touchscreen: Found absolute touchscreen
[    52.065] (**) Option "SwapAxes" "1"
[    52.065] (II) evdev: ADS7846 Touchscreen: Configuring as touchscreen
[    52.065] (**) evdev: ADS7846 Touchscreen: YAxisMapping: buttons 4 and 5
[    52.065] (**) evdev: ADS7846 Touchscreen: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
[    52.065] (**) Option "config_info" "udev:/sys/devices/platform/soc/3f204000.spi/spi_master/spi0/spi0.1/input/input4/event4"
[    52.065] (II) XINPUT: Adding extended input device "ADS7846 Touchscreen" (type: TOUCHSCREEN, id 6)
[    52.066] (II) evdev: ADS7846 Touchscreen: initialized for absolute axes.
[    52.066] (**) ADS7846 Touchscreen: (accel) keeping acceleration scheme 1
[    52.066] (**) ADS7846 Touchscreen: (accel) acceleration profile 0
[    52.066] (**) ADS7846 Touchscreen: (accel) acceleration factor: 2.000
[    52.066] (**) ADS7846 Touchscreen: (accel) acceleration threshold: 4
[    52.066] (**) Option "TransformationMatrix" "-1 0 1 0 -1 1 0 0 1"
[    52.068] (II) config/udev: Adding input device ADS7846 Touchscreen (/dev/input/mouse1)
[    52.068] (**) ADS7846 Touchscreen: Applying InputClass "calibration"
[    52.069] (**) ADS7846 Touchscreen: Applying InputClass "calibration"
[    52.069] (II) Using input driver 'evdev' for 'ADS7846 Touchscreen'
[    52.069] (**) ADS7846 Touchscreen: always reports core events
[    52.069] (**) evdev: ADS7846 Touchscreen: Device: "/dev/input/mouse1"
[    52.069] (EE) evdev: ADS7846 Touchscreen: Unable to query fd: Inappropriate ioctl for device
[    52.170] (EE) PreInit returned 2 for "ADS7846 Touchscreen"
[    52.170] (II) UnloadModule: "evdev"
[    52.173] (II) config/udev: Adding input device   Mini Keyboard (/dev/input/event0)
[    52.173] (**)   Mini Keyboard: Applying InputClass "evdev keyboard catchall"
[    52.173] (**)   Mini Keyboard: Applying InputClass "libinput keyboard catchall"
[    52.173] (II) LoadModule: "libinput"
[    52.173] (II) Loading /usr/lib/xorg/modules/input/libinput_drv.so
[    52.202] (II) Module libinput: vendor="X.Org Foundation"
[    52.202] 	compiled for 1.20.3, module version = 0.28.2
[    52.202] 	Module class: X.Org XInput Driver
[    52.202] 	ABI class: X.Org XInput driver, version 24.1
[    52.202] (II) Using input driver 'libinput' for '  Mini Keyboard'
[    52.202] (**)   Mini Keyboard: always reports core events
[    52.202] (**) Option "Device" "/dev/input/event0"
[    52.202] (**) Option "_source" "server/udev"
[    52.226] (II) event0  -   Mini Keyboard: is tagged by udev as: Keyboard
[    52.226] (II) event0  -   Mini Keyboard: device is a keyboard
[    52.227] (II) event0  -   Mini Keyboard: device removed
[    52.280] (**) Option "config_info" "udev:/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/0003:1997:2433.0001/input/input0/event0"
[    52.280] (II) XINPUT: Adding extended input device "  Mini Keyboard" (type: KEYBOARD, id 7)
[    52.280] (**) Option "xkb_model" "pc105"
[    52.280] (**) Option "xkb_layout" "us"
[    52.288] (II) event0  -   Mini Keyboard: is tagged by udev as: Keyboard
[    52.288] (II) event0  -   Mini Keyboard: device is a keyboard
[    52.293] (II) config/udev: Adding input device   Mini Keyboard Mouse (/dev/input/event1)
[    52.293] (**)   Mini Keyboard Mouse: Applying InputClass "evdev pointer catchall"
[    52.293] (**)   Mini Keyboard Mouse: Applying InputClass "libinput pointer catchall"
[    52.293] (II) Using input driver 'libinput' for '  Mini Keyboard Mouse'
[    52.293] (**)   Mini Keyboard Mouse: always reports core events
[    52.293] (**) Option "Device" "/dev/input/event1"
[    52.293] (**) Option "_source" "server/udev"
[    52.300] (II) event1  -   Mini Keyboard Mouse: is tagged by udev as: Mouse
[    52.301] (II) event1  -   Mini Keyboard Mouse: device is a pointer
[    52.301] (II) event1  -   Mini Keyboard Mouse: device removed
[    52.340] (**) Option "config_info" "udev:/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.1/0003:1997:2433.0002/input/input1/event1"
[    52.340] (II) XINPUT: Adding extended input device "  Mini Keyboard Mouse" (type: MOUSE, id 8)
[    52.341] (**) Option "AccelerationScheme" "none"
[    52.341] (**)   Mini Keyboard Mouse: (accel) selected scheme none/0
[    52.341] (**)   Mini Keyboard Mouse: (accel) acceleration factor: 2.000
[    52.341] (**)   Mini Keyboard Mouse: (accel) acceleration threshold: 4
[    52.348] (II) event1  -   Mini Keyboard Mouse: is tagged by udev as: Mouse
[    52.349] (II) event1  -   Mini Keyboard Mouse: device is a pointer
[    52.352] (II) config/udev: Adding input device   Mini Keyboard Mouse (/dev/input/mouse0)
[    52.352] (II) No input driver specified, ignoring this device.
[    52.352] (II) This device may have been added with another device file.
[    52.355] (II) config/udev: Adding input device   Mini Keyboard System Control (/dev/input/event2)
[    52.355] (**)   Mini Keyboard System Control: Applying InputClass "evdev keyboard catchall"
[    52.355] (**)   Mini Keyboard System Control: Applying InputClass "libinput keyboard catchall"
[    52.355] (II) Using input driver 'libinput' for '  Mini Keyboard System Control'
[    52.355] (**)   Mini Keyboard System Control: always reports core events
[    52.355] (**) Option "Device" "/dev/input/event2"
[    52.355] (**) Option "_source" "server/udev"
[    52.363] (II) event2  -   Mini Keyboard System Control: is tagged by udev as: Keyboard
[    52.363] (II) event2  -   Mini Keyboard System Control: device is a keyboard
[    52.364] (II) event2  -   Mini Keyboard System Control: device removed
[    52.400] (**) Option "config_info" "udev:/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.1/0003:1997:2433.0002/input/input2/event2"
[    52.400] (II) XINPUT: Adding extended input device "  Mini Keyboard System Control" (type: KEYBOARD, id 9)
[    52.400] (**) Option "xkb_model" "pc105"
[    52.400] (**) Option "xkb_layout" "us"
[    52.408] (II) event2  -   Mini Keyboard System Control: is tagged by udev as: Keyboard
[    52.408] (II) event2  -   Mini Keyboard System Control: device is a keyboard
[    52.412] (II) config/udev: Adding input device   Mini Keyboard Consumer Control (/dev/input/event3)
[    52.412] (**)   Mini Keyboard Consumer Control: Applying InputClass "evdev keyboard catchall"
[    52.413] (**)   Mini Keyboard Consumer Control: Applying InputClass "libinput keyboard catchall"
[    52.413] (II) Using input driver 'libinput' for '  Mini Keyboard Consumer Control'
[    52.413] (**)   Mini Keyboard Consumer Control: always reports core events
[    52.413] (**) Option "Device" "/dev/input/event3"
[    52.413] (**) Option "_source" "server/udev"
[    52.420] (II) event3  -   Mini Keyboard Consumer Control: is tagged by udev as: Keyboard
[    52.420] (II) event3  -   Mini Keyboard Consumer Control: device is a keyboard
[    52.421] (II) event3  -   Mini Keyboard Consumer Control: device removed
[    52.480] (II) libinput:   Mini Keyboard Consumer Control: needs a virtual subdevice
[    52.480] (**) Option "config_info" "udev:/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.1/0003:1997:2433.0002/input/input3/event3"
[    52.480] (II) XINPUT: Adding extended input device "  Mini Keyboard Consumer Control" (type: MOUSE, id 10)
[    52.480] (**) Option "AccelerationScheme" "none"
[    52.480] (**)   Mini Keyboard Consumer Control: (accel) selected scheme none/0
[    52.480] (**)   Mini Keyboard Consumer Control: (accel) acceleration factor: 2.000
[    52.480] (**)   Mini Keyboard Consumer Control: (accel) acceleration threshold: 4
[    52.488] (II) event3  -   Mini Keyboard Consumer Control: is tagged by udev as: Keyboard
[    52.488] (II) event3  -   Mini Keyboard Consumer Control: device is a keyboard
[    52.504] (**)   Mini Keyboard Consumer Control: Applying InputClass "evdev keyboard catchall"
[    52.505] (**)   Mini Keyboard Consumer Control: Applying InputClass "libinput keyboard catchall"
[    52.505] (II) Using input driver 'libinput' for '  Mini Keyboard Consumer Control'
[    52.505] (**)   Mini Keyboard Consumer Control: always reports core events
[    52.505] (**) Option "Device" "/dev/input/event3"
[    52.505] (**) Option "_source" "_driver/libinput"
[    52.505] (II) libinput:   Mini Keyboard Consumer Control: is a virtual subdevice
[    52.505] (**) Option "config_info" "udev:/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.1/0003:1997:2433.0002/input/input3/event3"
[    52.505] (II) XINPUT: Adding extended input device "  Mini Keyboard Consumer Control" (type: KEYBOARD, id 11)
[    52.505] (**) Option "xkb_model" "pc105"
[    52.505] (**) Option "xkb_layout" "us"

99-fbturbo.conf

# This is a minimal sample config file, which can be copied to
# /etc/X11/xorg.conf in order to make the Xorg server pick up
# and load xf86-video-fbturbo driver installed in the system.
#
# When troubleshooting, check /var/log/Xorg.0.log for the debugging
# output and error messages.
#The driver is made by Waveshare&Spotpear
# Run "man fbturbo" to get additional information about the extra
# configuration options for tuning the driver.

Section "Device"
        Identifier      "Allwinner A10/A13 FBDEV"
        Driver          "fbturbo"
        Option          "fbdev" "/dev/fb0"

        Option          "SwapbuffersWait" "true"
EndSection

99-calibration.conf
Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Option  "Calibration"   "3932 300 294 3801"
        Option  "SwapAxes"      "1"
        Option "EmulateThirdButton" "1"
        Option "EmulateThirdButtonTimeout" "1000"
        Option "EmulateThirdButtonMoveThreshold" "300"
EndSection

(reformatted by @gkkpch for readability)

Try removing

display_rotate=0

from “/boot/userconfig.txt”.

Remove display_rotate=0
Nothing happened.
Thank you for trying to help.

please try to add the rotation parameter in the declaration of the waveshare overlay

dtoverlay=waveshare35a,rotate=180

@Damur is right that the rotation parameter needs to be added to the overlay. But IIRC the line needs to read

dtoverlay=waveshare35a:rotate=180

I added in boot/userconfig.txt
dtoverlay=waveshare35a,rotate=270
and now it works fine.
Thank you gvolt and Darmur.

Add your custom config.txt options to this file, which will be preserved during updates

dtparam=spi=on
dtoverlay=waveshare35a-overlay
dtoverlay=waveshare35a,rotate=270
hdmi_force_hotplug=1
max_usb_current=1
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 480 320 60 6 0 0 0
hdmi_drive=2

Touch Display rotation setting below: do not alter

display_lcd_rotate=2
display_hdmi_rotate=2

you can remove this one, it’s not required

Okay! I will do as you said.