using Seerduino (Arduino) as MicroController instead of PIC18
Sangean ATS-909 PC Tools
Status: Beta
Brought to you by:
zharik
Hi there
I have my Sangean ATS909X and stumbled across your A/B Terminal project
I got interested but I would like to use my Seerduino (Arduino clone) with it instead of PIC18
my Seerduino has SCL and SDA pins and you can choose which voltage levels you want to use (3.3V or 5V)
so I am wondering what voltage levels does ATS909/909X expect as I don't want to blow it up
is its logical high 5V or 3.3V or something even lower
Thanks for Anwsering and Best Regards
Hi,
for ATS909X I2C levels 3.3V and they are more "stable" and "clean" than for classical ATS909. For the last one I have used 5V powered board and have to adjust SCL and SDA pull-ups rersistance to different values to "balance" those lines for MCU. More info about those adjustments are on the project main page http://ats909hoggy.sourceforge.net/ Due this specific of ATS909 model the making of universal adapter for both models I see as very problematic.
OK
Thanks
as Seerduino is using this Microcontroller: https://en.wikipedia.org/wiki/ATmega328
and does not have USB, only serial out
I was wondering do I have to read the whole EEPROM of my ATX909X out to ATmega328 as I have only 1Kb EEPROM on there or 2KB SRAM that could be problematic
or I can for a first PoC only read the first Page of stationns on FM for instance?
Thanks for Anwsering and Best Regards
also which Port (A or B) does SDA/SCL map to in ATS909X?
PS: do I have to use headphone jack ground or can I use a ground on the seerduino or leave ground unconnected?
Last edit: Jon 2019-08-14
Hi, Jon,
as far as I rememebr, the EEPROM dump is about 2048 bytes long for
ATS909 and a bit more (2560?) for ATS 909X. Receiver sends it in 256
byte long pages, page by page. There are no way to select a page to
download or download only one page - the whole EEPROM dump is send. So
to keep all data in your MCU - it has to have more RAM onboard.
Obviously you can download one or two pages to test your hardware, but
for working sample you need more RAM onboard.
Just for you information - device do not take care of I2C slave NACKs -
it sends data regardless of our acknowledgements or not acknowledgments.
Good luck and feel free ask for more information.
Jon писал 14.08.2019 16:34:
--
Kind Regards,
S.Zharski
Links:
[1] https://sourceforge.net/p/ats909hoggy/tickets/1/
Hi, Jon,
as far as I rememebr, the EEPROM dump is about 2048 bytes long for ATS909 and a bit more (2560?) for ATS 909X. Receiver sends it in 256 byte long pages, page by page. There are no way to select a page to download or download only one page - the whole EEPROM dump is send. So to keep all data in your MCU - it has to have more RAM onboard. Obviously you can download one or two pages to test your hardware, but for working sample you need more RAM onboard.
Just for you information - device do not take care of I2C slave NACKs - it sends data regardless of our acknowledgements or not acknowledgments.
Good luck and feel free ask for more information.
Thanks
decided to switch hardware a bit and will use Raspberry PI Model B+ which has 3.3V i2c and 512MB of RAM
I am a bit confused on how to use WiringPi with I2C even after reading this: http://wiringpi.com/reference/i2c-library/
still don't know I connect A to SDA and B to SCL or vice versa?, do I realy need ground?, because according to your previus comment: " Just for you information - device do not take care of I2C slave NACKs - it sends data regardless of our acknowledgements or not acknowledgments." I only need to connect SDA line since radio doesn't care for ACK/NAKs?
sorry because of so many questions but realy don't want to ruin my radio, I know using Hoggy Studio it would be easier but it only supports PIC18 so I need to tinker a bit more :)
Last edit: Jon 2019-08-16
Corresponding to http://ats909hoggy.sourceforge.net/usb-gpio12-connect.jpg SDA is B, SCL is A. Ground is required anyway to let the bus working. You cannot ruin your radio - even you load corrupted dump - its EEPROM will be reset to default set of station and settings. you cannot ruin your stations until you using "upload" command - i.e writing EEPROM to radio. Download EEPROM from radio is safe.
You should configure your I2C program as I2C slave with address 0x51 (AFAIR) and must reconfigure your slave address for receieving every next page to 0x52, 0x53, 0x54 etc on the fly. For ATS 909 slave address begins 0x58 etc. If you have any sample of EEPROM emulation program for Raspi - you can base your code on it.
are you sure that SCL is A and SDA is B, because whenever I try to connect my Raspberry PI B+ to the radio (did I mention that breadbord wires always fall out so its hard to make a solid connection without holding the wires and using at least 4 heands) its I2C pins are GPIO 2,4 like here: https://pinout.xyz/pinout/i2c#
than I tried to set my raspberry pi as I2C slave according to this: https://raspberrypi.stackexchange.com/a/91438
but whenever I connect any pin to A/B terminal the radio becomes unresponsive or starts to show garbage on the screen fortunately I can reset it and its fine but that was scarry :)
so I am a bit confused radio shouldn't freeze when connecting SDA to B and SCL to A right?
also I messured on B pin 2.5 Volts High and 1.5 Low(when pressing FM+Light to enter Data Out mode), is this realy 3.3V?
ATS909X I2C bus is loaded with much more functionality than in ATS909 - display control, frequency tuning etc. so it is not surprise, that adding extra pull-ups (to external power) to the bus will break the device/display functionality. :-) Try to not use pull-ups on your Raspi - just set SCL/SDA to Hi-Z. In opposite case you power the device's bus with extra 3,3V power.
By the way, AFAIR after sending (DATA OUT) all pages the receiver will try to reread they back from our adapter and (probably) compare (VERIFY) - and say FAILED in case such comparison has failed.
sorry didn't realy understand you on that: "Try to not use pull-ups on your Raspi - just set SCL/SDA to Hi-Z. In opposite case you power the device's bus with extra 3,3V power. "
can you clarify a bit
its interesting I didn't break anything in the proces :) yet :)
BTW: How would I check for sure which A or B pin is SCL or SDA can I do this with a multimeter?
I2C is based on using two pins - SDA, SCL that are connected to VCC using so known pull-up resistors. Devices on the bus shorts the lines to GND to produce signals and communicate.
ATS909X Device already has such pull-ups (just to let the internal I2C bus working) - and your Raspi has the same pull-ups - and extra external voltage comes to receiver's I2C bus through those resistors on Raspi. That voltage can make a distortions to signal and other participants on the bus, like display and CPU cannot comunicate in normal way - that's why you see garbadge on display and breaks in device functionality.
The I2C bus is persistently on work - some data comes from CPU to display every second. It work at AFAIR 30-40 kHz. With multimeter you can observe only mean voltage that is obviously less than VCC. More detailed info can be observed with oscilloscope or logical analyser.