Specialty pharmaceutical company BioDelivery Sciences International (NASDAQ:BDSI) swung to a $13.1 million loss in the second quarter compared to $3.7 million in net income in the same period a year ago.

Second quarter revenue was $2.7 million, a decrease from the $16.2 million in the second quarter of 2012. The change reflects the $15 milestone payment from drug partner Endo Health Solutions that BDSI recorded a revenue in May 2012.

Raleigh-based BDSI has one commercialized product so far – breakthrough cancer pain treatment Onsolis. Onsolis is approved for the U.S. market but it is currently unavailable while BDSI works out some issues with the Food and Drug Administration. Onsolis entered European market last October under the name Breakyl. In the second quarter, Breakyl accounted for $900,000 in royalty revenue for BDSI.

BDSI is making progress on its drug pipeline. The company said it is on track to report in early 2014 late-phase clinical trial data for its chronic pain drug candidate BEMA Buprenorphine. Completing the trials and filing a new drug application with the Food and Drug Administration positions BDSI to receive $30 million in milestone payments from Endo.

R&D expenses totaled $12.8 million in the second quarter, up from $6.5 million in the same period in 2012. The company attributed the increase to the two pain trials and one safety trial for the BEMA Buprenorphine chronic pain program.

As of June 30, BDSI had $37.4 million in cash. That total does not include proceeds received in early July from a $20 million loan.