This worked to get calendar and contacts to sync perfectly on my iphone 3g,
mac13k wrote this on onother post:
For calendar sync.
1. Go to Settings/Mail, Contacts, Calendars/Add Account.../other/CalDav
2. Type the following settings:
Server: caldav.icloud.com
User Name: your @me.com address
Password: your MM password
Description: Contacts iCloud
3. press Done and wait. The verification can take some time. After that you will have a new CalDav account. If you are lucky it will sync and you are home. If you are like me it will not sync. We need to make one adjustment.
4. Go to your new CaldDav account settings. You may notice that the server name has been changed to p02-caldav.icloud.com or something like that (p01, p03 etc.). That's good. We want that.
5. Now tap on "Advanced Settings" and copy the Account URL (all of it: fromhttps:// ... to principal).
6. go back to your CalDav account click on Server. Delete the current address ("p0x-caldav.icloud.com") and paste the address you copied from advanced settings. Hit Done and wait for verification. Now it should sync.
Fllow the same procedure for contacts with one difference - in step 2 you type contacts.icloud.com as server address.