Shares of InvenSense (INVN) are trading near a 52-week low three weeks after the company reported some very disappointing results in its fiscal second quarter. Despite picking up a big design win from Apple (AAPL -1.22%), the company missed expectations on the top line (by a little) and the bottom line (by a lot). Additionally, its forecast for this quarter missed analyst expectations as well.

InvenSense chips do a lot. Source: InvenSense

The stock plunged 24% immediately after its earnings release as a result multiple analyst downgrades and institutional investors dumping shares. Over the next three weeks, shares fell another 14%.

Now trading 35% below its price just three weeks ago, is InvenSense a buy?

What's behind that dismal bottom line?
Last quarter, InvenSense reported earnings of just $0.05 per share where analysts were expecting $0.17 per share. However, the top line miss wasn't nearly as bad -- $90.2 million vs $90.5 million.

The difference is found in the company's gross margin, which slumped to 37% compared to expectations and a company forecast for 50%. So, the question for investors is how much of InvenSense's gross margin decline is permanent.

Lucky for us, management was kind enough to answer this for us. On the earnings call, newly hired CFO Mark Dentinger gave us three root causes of the gross margin decline:

InvenSense supplied the 6-axis sensor (outlined in black) in Apple's iPhone 6 and 6 Plus. Source: iFixIt

First, the company had to writedown $7.4 million in inventory that is now in excess or obsolete. The result was an eight percentage point decline in gross margin.

This is actually a double whammy because the stock got hit earlier in the year when the company built up its inventory (supposedly with expectations of selling it to Apple), and now that inventory isn't worth as much as expected. The good news for investors is that this is clearly a one-off expense.

Second, the company faced pricing pressure from its biggest customers (i.e. Apple and Samsung), which drove down average selling price. The result was a three percentage point decline.

This is a more permanent problem, and Apple's tendency to lean on its suppliers for the best pricing means that pricing pressure could become an even larger issue in the future if Apple designs become a higher percentage of revenue with the addition of products like Apple Watch and 100% share of iPhones.

Finally, manufacturing costs of new products were higher than expected, resulting in a two percentage point decline in gross margin. While the company expects this problem to continue into the third quarter, the company should be able to mitigate the issue sooner rather than later.

As it turns out, maximizing yield with a new process is pretty hard, but over time InvenSense should be able to figure out how to get the most good chips out of a wafer (as it and every other semiconductor manufacturer always have). The addition of Apple and additional design wins with Samsung for high-end phones meant InvenSense needed to ramp up production on its newest process before it was able to maximize yield.

In that light, Dentinger's expectations that gross margin will improve to 46% to 47% this quarter make perfect sense.

What can investors expect in the long run?
InvenSense previously guided its long-term gross margin expectations between 50% and 55%. Those numbers may be out of reach now with a high concentration of revenue coming from big customers commanding lower ASPs. Last quarter, 55% of revenue came from customers accounting for more than 10% of revenue.

The good news is that the company still expects strong revenue growth going forward, saying that fiscal 2015 revenue growth may exceed the high-end of its 25% to 35% guidance. That guidance didn't include additional design wins like the iPhone 6, so it would actually be disappointing if InvenSense didn't exceed those numbers. As a result, analysts currently expect 43% revenue growth.

There are additional opportunities for InvenSense to grow revenue as well, particularly in wearables. Next year's launch of the Apple Watch could have an impact on InvenSense's fourth quarter if it's indeed won the design as many have expected. Samsung, Xiaomi, and LG are likely to tap InvenSense as well, but these big customers could lower InvenSense's ASP and continue putting pressure on the company's margins.

So, is it a buy?
Certainly, InvenSense shares deserved a bit of a sell-off due to the higher than expected impact from Apple on gross margin and the inventory write-off. The poor outlook for next quarter caused analysts to decrease their consensus earnings expectation for fiscal 2015 more than 40%, and fiscal 2016 expectations are down 35%.

While the company is facing some near-term issues from manufacturing yield and a one-time impact from an inventory write down, it's also facing long-term pressure from a high customer concentration. For long-term investors, though, the opportunity for revenue growth seems to outweigh the pressure on the margins.

Considering the growth opportunities still ahead for InvenSense in the future, analysts may be overcompensating for the company's near-term struggles. The decline in stock price is closely tied to the decline in analyst expectations, not a decline in earnings multiples. Therefore, it seems InvenSense has become underpriced.