Hi,
What is your switches and how did you configured, can you share configuration. You can configure as below with vlan interfaces. You can not ping loopback interfaces you need to add route for loopback interfaces.
SW1
int vlan 1
ip add 1.1.1.1 255.255.255.252
!
SW2
int vlan 1
ip add 1.1.1.2 255.255.255.252