Go Down

Topic: 8mhz smd clock source ATtiny841 (Read 1 time) previous topic - next topic

drummin89

Aug 15, 2018, 03:32 am Last Edit: Aug 16, 2018, 03:05 am by drummin89
I am working on redesigning a pcb I did previously. The overall size is not much bigger than a nRF24L01 transiever module which is made to plug into the top of my board. It is for a wireless sensor node.  Dimensions are just under 1.5 inches by 0.75 inches.

Anyways I am redesigning the board to fit an external clock source. I am looking for an external clock source (crystal, resonator, etc) that will work with the Attiny841 and not take up too much space.

I was looking at a HC49 8mhz crystal but it takes up a lot of space on the board, almost 2/3 of the width of my board. I was wondering if a oscillator or resonator (in smd form) would work. How do I which one to go with.

Thanks!

srnet

Take a look at an 8Mhz Pro Mini.

They use small '8mhz smd clock source' and as there used we can assume they work. 
No PMs please, they dont get answered.

Riva

Do you really need an external clock? AFAIK the Attiny841 can use its internal clock to generate 8MHz
Don't PM me for help as I will ignore it.

drummin89

Do you really need an external clock? AFAIK the Attiny841 can use its internal clock to generate 8MHz
It can. Not sure if I am missing something but I believe I am having issues getting SPI to work on the internal clock. My current wireless node board does not use an external clock, its using the internal set at 8mhz, powered by 3.3v. I have not been able to get the 841 to communicate to the nRF24L01 module. I bought a Attiny841 development board which uses an external 8mhz crystal and everything works as intended. The only difference between the 2 boards is that mine does not have the external crystal.


Is the pro mini using a resonator or a oscillator. I am going to dig around to see if I can come up with a part number. The size would be perfect.

drummin89

#4
Aug 15, 2018, 04:14 pm Last Edit: Aug 15, 2018, 04:15 pm by drummin89
I found the resonator that the pro mini uses. Its made by muRata and I found them on mouser.

https://www.mouser.com/datasheet/2/281/p16e-522700.pdf

I believe I am looking for part # CSTCE8M00G but I am not sure what to pick for the tolerance or the load capacitance. I was thinking 1% and 33pF but I really don't know what I am doing. 10pF and 33pF seem to be the most common and I am not going into production with these but 5% save like 20 cents/each.

https://www.mouser.com/ProductDetail/Murata-Electronics/CSTCE8M00G15L99-R0?qs=sGAEpiMZZMsBj6bBr9Q9aXA3ATl0diAhCINIMnvOD3Y%3d

https://www.mouser.com/ProductDetail/Murata-Electronics/CSTCE8M00G52-R0?qs=sGAEpiMZZMsBj6bBr9Q9aTcK%252bRPmoof3LSI08NhEyDk%3d

DrAzzy

#5
Aug 15, 2018, 05:45 pm Last Edit: Aug 15, 2018, 05:47 pm by DrAzzy
What makes you suspect the problem is the clock source? Problems with internal clock come from it not being accurate enough, and typically impact only serial and other timing-sensitive things (like outputting pwm at an exact frequency) - and even so, the attiny841 at 3.3v is calibrated to within 2%, making it fine for serial.

Triple-check all wiring (make sure you're not getting it mixed up with the pinout of the ATTiny84).

Also, you often need additional capacitors for decoupling/filtering with the NRF24's - many of the modules don't have sufficient decoupling and when they try to transmit, the current spike puts a glitch on their power rail sufficient to hang the NRF24. A quick bit of googling will get suggestions for the capacitor values.

You did do burn bootloader first, so it's running at 8MHz not 1MHz?
ATTinyCore and megaTinyCore for all ATtiny, DxCore for DA/DB-series! github.com/SpenceKonde
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

srnet

Is the pro mini using a resonator or a oscillator.
The el-cheapo Pro Minis mostly use a reasonator.
No PMs please, they dont get answered.

drummin89

#7
Aug 15, 2018, 06:17 pm Last Edit: Aug 15, 2018, 06:25 pm by drummin89
What makes you suspect the problem is the clock source? Problems with internal clock come from it not being accurate enough, and typically impact only serial and other timing-sensitive things (like outputting pwm at an exact frequency) - and even so, the attiny841 at 3.3v is calibrated to within 2%, making it fine for serial.

Triple-check all wiring (make sure you're not getting it mixed up with the pinout of the ATTiny84).

Also, you often need additional capacitors for decoupling/filtering with the NRF24's - many of the modules don't have sufficient decoupling and when they try to transmit, the current spike puts a glitch on their power rail sufficient to hang the NRF24. A quick bit of googling will get suggestions for the capacitor values.

You did do burn bootloader first, so it's running at 8MHz not 1MHz?
Just a guess really. I don't know what it could be. Just figured I'd try making a board with an external clock to see if it makes a difference. Not using a bootloader. Uploading sketches via a USBtinyISP (Sparkfun AVR pocket programmer). I did select the 8mhz internal clock setting and other options through the arduino IDE and select to burn the bootloader to set the fuses before using my board for the first time. Said it was successful.

The development board I got is your Attiny841 board you have for sale on Tindie. 3.3v, external 8mhz crystal. Used jumpers from the nRF24 module to the dev board. No additional caps for the nRF24 and it worked flawlessly. Plug the nRF24 into my board, and it doesn't work. I coded in a heartbeat pulse on one of the spare digital pins just so I could check that its executing and it is. 2 second pulse on then off looks to be about 2 seconds.

I have a 0.1uF capacitor for both the attiny and the nRF24 module and a 10uF located between them both. In my final design the nRF24 module is soldered directly to my board. The 4x2 socket is just for testing. I made up a couple of these boards, some are soldered directly.

Here is my post about trying to get the nRF24 working with the Attiny841 on my board I made. https://forum.arduino.cc/index.php?topic=561947.0

drummin89

The el-cheapo Pro Minis mostly use a reasonator.
Sparkfun's pro mini looks to use a ceramic resonator.
https://www.sparkfun.com/products/11114
 I have a number of these pro mini's that I got off eBay that I used initially for my wireless nodes. These worked without any problems as well but I wanted a small board that the nRF could plug into and be as compact as possible. These have the ceramic resonator as well.

drummin89

Well interesting development. I decided to try burning the 8mhz internal optiboot bootloader to my board and low and behold IT WORKS!!!. That was the only other thing that was different between the development board and my board besides the crystal.

DrAzzy

But if you go back to 8mhz internal (no bootloader) and burn bootloader, then upload via ICSP, it doesn't work?

Also, how did you upload the sketch after doing that, via serial or via ICSP?



That represents a serious defect in my core if this is reproducible... Any sketch that works with the bootloader should work without it! (and any sketch that works without the bootloader should work with it, unless it uses the WDT as an interrupt source).
ATTinyCore and megaTinyCore for all ATtiny, DxCore for DA/DB-series! github.com/SpenceKonde
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

drummin89

You made me curious so I tried it.

I did just as you said, went back into the IDE, selected ATtiny441/841 (no bootloader), selected Chip: ATtiny841, Clock: 8 MHz (internal). Hooked up the USBtinyISP and clicked burn bootloader. Finished successfully.

Proceeded to upload my sketch via the USBtinyISP programmer. It was executing my code (heartbeat on output pin was pulsing) but it was not communicating with the nRF24.

Burned the bootloader back onto the chip, uploaded my sketch via serial, and everything was back to working as intended.

DrAzzy

Hmmm - wait, did you completely power cycle it between the ISP upload and testing it?

If not - try it (unplug the running-sketch-but-not-working unit from all power, wait a minute or so to make sure the caps are discharged, and plug it back in.

If it does work, that means the problem was that the ISP programming process confused the NRF24. Which wouldn't be terribly surprising, since the NRF24's CS (the line you drive low to select the device) lines would be floating, and they'd be seeing piles of garbage fly by whenever CS floated low..... Solution is to add a pullup resistor on the CS line in this case.
ATTinyCore and megaTinyCore for all ATtiny, DxCore for DA/DB-series! github.com/SpenceKonde
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

drummin89

I remove power and unplug the nRF24 whenever uploading the sketch via ISP. Have to in order to access the ICSP pins. Upload sketch, unplug programmer from board (I use Pogo pins), plug in nRF24 module and then apply power from a separate 3.3v supply capable of providing the juice the nRF24 module requires.

MarkT

I was looking at a HC49 8mhz crystal but it takes up a lot of space on the board, almost 2/3 of the width of my board. I was wondering if a oscillator or resonator (in smd form) would work. How do I which one to go with.

Thanks!
The way to locate components is go to the website of an electronics supplier (Mouser, Element14, DigiKey, etc),
and use their parametric search facilities...  Plenty of 7mmx5mm, 5mmx3mm and even smaller ones about
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

Go Up